home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 71.zip / BS1 part 71 / Doc Disk30.adf / SuperBase4.pp / SuperBase4
Text File  |  1992-11-07  |  301KB  |  7,089 lines

  1.             SUPERBASE
  2.  
  3. WELCOME TO SUPERBASE   
  4.  
  5. This Introductory session with Superbase will give you an understanding of
  6. how to perform some of the basic database operations of the Superbase system.  Some more complex functions are explained in the section Working with Superbase.
  7.  
  8. OPENING A FILE
  9.  
  10. If you look at the top left-hand corner of the screen you will see a
  11. message that reads "Superbase:  Please open a file".  You always see this
  12. message when you start Superbase up, or when there is no file open.  Since
  13. you can't do any work without a file, let's open one and take a look at it.
  14.  
  15. Files can only be opened from the Project menu.  This is the first menu on
  16. the menu bar.
  17.  
  18. SUPERBASE REQUESTERS
  19.  
  20. Superbase now requestes the name of the file you wish to open.
  21.  
  22. Requesters like this one (some are more complicated) are used in most
  23. Superbase operations.  They also communicate messages to the user.  They
  24. are known as requesters because their function is to request specific
  25. action from the user.  Usually the action involves making selections by
  26. clicking the mouse or typing in a number of a text value of some kind.
  27.  
  28. Many requesters show a panel that contains a list of items such as file
  29. name or field names.  The panel may be only a few lines long, so there may
  30. be more files or fields than can be shown at one time.  If there's a gap at the bottom of the scroll bar there are more items to be viewed.  You can show them by dragging down the scroll bar at the right of the panel, or by clicking on the downwards pointing arrow gadget below the scroll bar.
  31.  
  32. Many Superbase requesters include a Clear button.  This has the effect of
  33. removing anything that's in the Selection Box, and can be used at any time.
  34.  
  35. CHOOSING THE ADDRESSES FILE
  36.  
  37. Move the pointer into the panel which contains a list of file names.  Move
  38. it over the file name Addresses.  This is the demonstration file you'll be
  39. using for the rest of this session.  Using the left-hand button, click once on the name Addresses.  Superbase copies the name of the file you've
  40. selected into the Selection Box -- that's the box underneathe the panel of
  41. tile names.  (If you see the wrong file name in the box, move the pointer
  42. carefully onto the right file name, and click again.) Once you've selected
  43. the file, move the pointer onto the OK button and click once.  Superbase
  44. now opens the Addresses file.
  45.  
  46. THE MAIN DISPLAY
  47.  
  48. When Superbase opens a file from the start up screen, it automatically
  49. reads the first record in the file and shows it on the Main Display screen. You'll see the name of the file appear on the title bar at the top of the window, followed by the name of the field on which the file is currently indexed.
  50.  
  51. The Main Display is Superbase's permanent window onto your database.  It's
  52. like a large worksheet, 273 colulmns across; the number of lines you can
  53. see depends on the size of your window.  Surperbase uses the Main Display
  54. to show you the records in the current file, as well as the results of some other operations.  At the bottom of the Main Display is the Control Panel, which we'll be looking at in a minute.
  55.  
  56. On the Main Display, the field names for each record in the Addresses file
  57. appear down the left-hand side of the screen.  The data for each filed is
  58. displayed to the right of its field name.  If the data for a filed is wider than the window, it extends off to the right.  You can bring it into view using the scroll bar at the bottom of the window.
  59.  
  60. Remember that if there were more fields in the record than you could see,
  61. you could view them by dragging the scroll bar at the right of the window
  62. downwards, or by clicking on the downward pointing arrow.
  63.  
  64. RECORD VIEW, FORM VIEW AND TABLE VIEW
  65.  
  66. The record format you're looking at now is only one of the three possible
  67. ways of looking at your file.  It's called Record View.  This view shows
  68. the records one at a time, restricting the format by keeping the field
  69. names on the left and limiting you to one field per line.  This restriction allows records to be scrolled up and down the screen with the Control Panel buttons.
  70.  
  71. In Form View, you also see one record at a time.  Each record is like a
  72. form or page and, as you'll see later, you can drag the fields around to
  73. create a worksheet desinged to suit your application.
  74.  
  75. The third display format is Table View.  This displays the field names
  76. across the top of the screen with the data appearing in rows and columns,
  77. each record occupying one line.
  78.  
  79. SWITCHING TO TABLE VIEW
  80.  
  81. Select Table View from the Set Menu.  You will see the field names appear
  82. across the top of the screen.  The same record is shown, but each item of
  83. data appears underneath its field name.  As with Form View, there are ways
  84. of changing this row and colulmn display to suit your own preferences which we'll explain later.
  85.  
  86. SCROLLING THE SCREEN
  87.  
  88. While you are viewing your record in Table View you will notice that the
  89. field names do not all fit onto the screen.  The fileds to the right can be viewed using the arrow at the right of the bottom scroll bar.  Move the
  90. pointer onto this arrow, and click on it once.  The display shifts five
  91. columns to the left.  Click once on the left-hand arrow to shift right and
  92. restore the display.  If you want to shift the display by larger areas,
  93. drag the bottom scroll bar with the mouse.
  94.  
  95. CONTROL PANEL
  96.  
  97. Now that you've opened a file, and discovered how to change the way in
  98. which records are displayed on the screen, let's look at the Control Panel. This is your means of controlling the main display.  As you can see there are 12 buttons, most of them modelled on the controls for a video cassette or tape recorder, so you should find these conventions easy to learn and remember.
  99.  
  100. Each button has a special purpose, and together they fall into three
  101. groups.  On the left are the Pause and Stop buttons.  Followed by seven
  102. buttons for browsing through the file.  On the right are three special
  103. purpose buttons which we'll examine later.  The functions of some controls
  104. are more intuitively obvious than others, so we'll take a look at the first nine now, one by one.  Make sure you've set Table View for this exercise.
  105.  
  106.     ^       Current Record:  This button is used to display the current
  107. record.  When Table View has put a lot of records on the screen it can be
  108. helpful to select the current record as the top record in the display.
  109. Also, you can only Edit the current reacord, and this button is a useful
  110. way of ensuring that you've got the right record.  If you click on this
  111. button you will notice that Superbase clears the screen and then displays
  112. the current record.
  113.  
  114.     >    Next Record:  Allows you to view the next record in the file. 
  115. The order in which the records appear is dicided by the current index,
  116. which is shown by the message on the title bar of the main display window.
  117. Try this now, and you'll see the data for the next record come onto the
  118. screen.  In Table View it appears underneath the previous record.  In Form
  119. View it replaces the previous record.
  120.  
  121.     <    Previous Record:  This gets the previous record in the file, 
  122. relative to the current record.
  123.  
  124.     >>    Fast Forward:  Instead of moving forwards through the file one
  125. record at a time by pressing the Next button, you can move much quicker
  126. using the Fast Forward button.  Click on this button, and Superbase gets
  127. the next records in the file, displaying them row by row until the screen
  128. is full, when it selects the Pause button.
  129.  
  130.     ||    Pause:  When the Pause button is selected, you cannot select 
  131. any menu item until you either release it or click on the Stop button next
  132. to it.  You can, however, use the other Control Panel buttons.  So, to view the next screen of records, release the pause by clicking on the Pause button.  Superbase continues with the Fast Forward display of records, stopping when the next screen is full, or when it reaches the end of the file.  Pause is useful when you're searching for a record and you want to stop from time to time to read the screen.
  133.  
  134.     <<    Rewind:  This does the opposite of the Fast Forward button.  
  135. You will see the data appear from the top of the screen,in reverse index
  136. order.  If you do this immediately after Fast Forward there will be an
  137. apparent delay while Superbase displays records over the text of the
  138. existing display.
  139.  
  140.     |<    First:  Pressing this button automatically displays the first 
  141. record in the file, according to current index order.
  142.  
  143.     >|    Last:  Pressing this button automatically displays the last 
  144. record in the file, according to current index order.
  145.  
  146.     |    Stop:  If you want to stop the Fast Forward or Rewind display,
  147. click on Stop.  You must also click on Stop if you want to interrupt Pause
  148. when it's selected.
  149.  
  150. OPENING FIELD TO VIEW
  151.  
  152. As Superbase imposes no limit on the number of fields per record, you need
  153. to have a way of restricting the fields that actually appear on the Main
  154. Display.  You can do this with the Open Field option on the Project Menu.
  155.  
  156. Display the Project Menu, and select Open Fields.  The basic procedure for
  157. selecting fields is very simple:
  158.  
  159. 1.  Click on a field name in the left-hand panel.  Superbase copies it into the right-hand panel.  
  160. 2.  Repeat until the selection of fields you want is in the right-hand
  161. panel.  
  162. 3.  Click on OK.
  163.  
  164. The list of fields in the right-hand panel is called the Open Fields List.
  165. Let's make one now.  Move the pointer onto the list of fields names, and
  166. click on City.  Nitice how Superbase copies it across.  Now click on
  167. Lastname.  When you have both names in the list, click on OK.  (If you make a mistake, DEL romoves the current field from the right-hand panel; Clear removes the whole list.)
  168.  
  169. Superbase immediately returns to the Main Display showing the data for the
  170. two open fields.  Try out the Control Panel buttons to see their effect.
  171. Experiment with Record View as well as Table View.
  172.  
  173. When you've finished, restore the full set of fields by selecting Close
  174. Fields from the Project menu.
  175.  
  176. PAGING
  177.  
  178. This is another feature which gives you control over the Main Display:
  179. the Paging option.
  180.  
  181. If Record View is not set, select it now from the Set Menu.  Then go back
  182. to the Set menu, and move the pointer down to the Paging item, which should have a check mark against it.  Release the mouse button while Paging is highlighted.  You've now turned the paging option off.  (You can check this by looking at the Set menu again; there should be no check mark against the Paging item.)
  183.  
  184. Now, select the first record in the file by clicking on the First Record
  185. button.  Then click on Fast Forward, and watch the display.  You'll see
  186. that Superbase down't pause when the screen is full -- It just goes on
  187. displaying records.  You can still use pause to halt the display, but the
  188. automatic pausing at the end of each "page" of data no longer occurs.  The
  189. same applies when Rewind is in use, except that the records appear at the
  190. top of the screen.
  191.  
  192. If you now switch back to Table View and try out some of the Control Panel
  193. buttons, you'll see that with Paging off the difference is similar to that
  194. in Record View.  Each record appears below the last, without clearing the
  195. screen.  Rewind displays records from the top down, as in Record View.
  196.  
  197. MOVING COLUMNS
  198.  
  199. For this exercise you need to be able to see all the fields on the screen,
  200. not just those in the Open Fields list, so if you have an open Fields list
  201. in use, close it now by selecting Close Fields from the Project Menu.
  202.  
  203. You can see that if you have all the fields open in Table View, some of the field data is very likely to be hidden from view.  Normally, to see hidden fields you have to scroll the screen to the right.  However, Superbase provides a way of closing up columns to get more data on the screen.
  204.  
  205. Assuming you're in Table View -- set it if you're not -- click on the
  206. First button, then the First Record button on the Control Panel in order to get the first record of the Addresses file on your screen.
  207.  
  208. MOVING A COLUMN TO THE LEFT
  209.  
  210. Now move the pointer so that it is on the space to the right of "M" in the
  211. Title Field.  Once you have done that press and hold down the left-hand
  212. button of the mouse.  As you do this you will see two vertical lines
  213. appear, forming a column beneath the Title field.  There are also lines
  214. extending off to the right of the screen.
  215.  
  216. Keeping the left button depressed, drag the pointer a little to the left,
  217. then release the mouse.  You will see that the column moves, and when you
  218. release the mouse the data beneath the field name has shifted to the left.
  219. All columns to the right have also moved leftwards.
  220.  
  221. Now try the same with the Forename field.  This time ove the column so
  222. that it is just to the right of the "e" in Title.  If you also try this
  223. with Lastname and Street you will see that as you move the columns over to
  224. the left the field name City appears on the right of the screen.
  225.  
  226. If you now move the City column to the left, the Code field will appear on
  227. the screen.  Finally, if you move the Code field, Country will appear on
  228. the right- hand side.  So by moving the columns you've got all the fields
  229. on one screen instead of two.
  230.  
  231. Notice that you can move a column so that it overlaps the column to its
  232. left, truncating the data.  This can be useful.
  233.  
  234. MOVING A COLUMN TO THE RIGHT
  235.  
  236. If you move a column back to the right, the truncated field name and data
  237. are not automatically restored to their full length.  A quick way of
  238. restoring the length of a fiels is to double click in its column.  Then if
  239. you click on the Current Record button the full field name and data will
  240. reappear.  But as this only displays one record you will have to use Fast
  241. Forward if you want to redisplay a screen of Record data.
  242.  
  243. FORM VIEW DESIGN
  244.  
  245. Superbase allows you to rearrange the positions of the fields in Form
  246. View, setting more than one field on a line, creating columns of field to
  247. resemble invoices or other business forms, and generally talloring the
  248. system to suit your own application.  The full 273 column woeksheet is
  249. available for Form View, and you can vary the depth by dragging fields
  250. downwards, creating new lines.
  251.  
  252. You can use Form View for creating new records and editing them, as well as for display.  By setting the Printer option on, you can copy the visible portion of the worksheet to the printer.
  253.  
  254. Select Form View now from the Set Menu.
  255.  
  256. Make sure you've got the Addresses file open, and that the current record
  257. is the first record in the file.
  258.  
  259. DEFAULT FORM VIEW
  260.  
  261. If you look at the screen you can see that the fields names already appear
  262. in a Form View.  This is the default Form, which we have predefined for
  263. this demonstration file.  You can change it, and then save it with Project
  264. Save File.  Once a Form has been saved, the fields will appear in that
  265. layout every time you open the file.
  266.  
  267. MOVING FIELDS
  268.  
  269. Let's move the Lastname field to another position on the screen.
  270.  
  271. Move the pointer so that it's on the field name Lastname.  Then press and
  272. hold down the left-hand button of the mouse.  Superbase outlines the field
  273. name and its data area.  (If you see a cursor instead, you've started
  274. editing by mistake.  Carefully click again on the field name itself.) Now
  275. drag the outlined box to a new position two lines above its present
  276. position.  Release the mouse button.  As you can see, the field name and
  277. data have moved to this new position.
  278.  
  279. Now, if you want to, you can arrange the Form View for Addresses in any
  280. way you like.  This can be just an experiment, but if you want to save the
  281. present arrangement, you can do so.  Select Save File from the Project
  282. Menu.  Superbase stores the File Definition, which contains the Form View
  283. location of each field, on disk.
  284.  
  285. Although you have freedom to drag fields to any position on the screen,
  286. there are as usual a few limits to what you can do.
  287.  
  288.     You cannot place a field on top of either the name or the data area
  289. of another field.  If you try this, Superbase leaves the field you tried to drag in its original position.
  290.  
  291.     Superbase won't let you move a field off the right or left-hand end
  292. of the worksheet.
  293.  
  294.     To gain more lines, move a field down into the Control Panel.  Then
  295. use the vertical scroll bar on the Main Display window to bring it back
  296. into view.  Move it down again if you still need more lines.
  297.  
  298.     To move a field over to the right of the worksheet, position it
  299. near the right-hand edge of the screen, then shift the display with the
  300. scroll bar, and drag the field further over.
  301.  
  302.     Only the open fields are shown, so close the Open Fields List if
  303. you want to see all the fields in Form View.
  304.  
  305. Finally, a small but entertaining feature.  Select Fast Forward, and drag
  306. the fields around as described above.  No problem.
  307.  
  308. SUMMARY
  309.  
  310. Time for a check list of what you should know before we proceed.
  311.  
  312.  
  313. *    How to open a file
  314. *    How to switch betgween Form View, Table View, and Record View
  315. *    How to switch Paging off and on
  316. *    How to drag columns around in Table View
  317. *    How to Open and Close a list of fields
  318. *    How to select the Current record
  319. *    How to move to the First record
  320. *    How to move to the Last record
  321. *    How to move to the Next record
  322. *    How to go to the Previous record
  323. *    How to use the Fast Forward to move forwards through the records
  324. *    How to Rewind to move backwards through the file
  325. *    How to Pause
  326. *    How to Stop
  327.  
  328. Understanding all these actions is essential if you wnat to be able to
  329. work easily with Superbase.  If you do not understand them or are uncertain then take a little time to go back and re-read the appropriate sections before continuing.
  330.  
  331. THE KEY LOOKUP BUTTON
  332.  
  333.     ?    Key Lookup:  This is for the retrieval of individual records.
  334. You enter a value for the field on which the file is currently indexed, and Superbase uses the index to find and display the record.  You can only use one index field at a time -- the Filter button is used for multiple value searching.
  335.  
  336. When you click on the Key Lookup button you'll see a requester for the
  337. entry of a key value.
  338.  
  339. TYPING IN YOUR KEY
  340.  
  341. To be able to type in the box, you must move the pointer into it and click
  342. the mouse once.  This produces the cursor, and you can then type in your
  343. Index Key.  Suppose you want to find the record for Julie Kasper.  The file is indexed on the Number field, so we can use the current index to search for individuals by their Reference Numbers.  Click in the box and then type in "KAS0001" (omit the quotation marks).  This is the Index Key.
  344.  
  345.  
  346. RETRIEVING THE RECORD
  347.  
  348. When you press Return or click on OK, Superbase looks up the first record
  349. for which the Number field has the value "KAS0001".  If there were more
  350. than one with this value, you would have to browse through the file with
  351. the Next Record or Fast Forward button to find the exact record you wanted.
  352.  
  353. KEY LOOKUP WITH A DIFFERENT INDEX
  354.  
  355. You're not restricted to one index.  Superbase allows you to have up to 999 indexes for each file, all automatically updated when you add or modify records.  We've provided indexes on the other fileds besides the number field:  Lastname, City and Country.  Let's try one of these.  Select Open index from the Project Menu.
  356.  
  357. Click on the field name Lastname; this is copied into the Selection Box.
  358. When you're ready, click on OK.  You've selected the Lastname index, and if you look at the title bar at the top of the window you'll see that the
  359. message now reads "Superbase:  Addresses Indexed on Lastname".
  360.  
  361. The record on the main display has not changed.  Click on the Key Lookup
  362. button, and Superbase produces the Record Key requester.  As you did above, click in the box and type in a key value, only this time type in "Forge". Press Return or click on OK, and Superbase looks up the first record with Forge in the Lastname field.
  363.  
  364. ENTERING PARTIAL VALUES 
  365.  
  366. You don't even need to type the full index key in many cases.  Try Key
  367. Lookup once more, but type in "Hut" and press Return.  Superbase finds the
  368. first record for Huttermann.  For your information, Superbase tells you
  369. that it didn't find the exact match.
  370.  
  371. THE FILTER BUTTON
  372.  
  373.     =    Filter:  This is a very powerful feature.  You may have 
  374. thousands of records in a database file, yet you may often want to review
  375. them (or print them out) on a selective basis.  The Filter allows you to
  376. enter a set of values, as simple or a comprehensive as you like, to
  377. restrict the display to only the records that match those values.
  378.  
  379. THE FILTER REQUESTER
  380.  
  381. Move the pointer and click on the Filter button on the Control Panel.
  382.  
  383. This requester looks more complex than the ones you have seen so far, but
  384. after a little practice with the demonstration file you'll find that you
  385. can remember how to use it easily.  It's important that you learn how to
  386. use the Filter, because Superbase uses filters in several other functions.
  387.  
  388. The requester has four main parts:  the Field Name Panel, the Operators,
  389. the Value Box, and the Main Box.  A Filter is created by a combination of
  390. clicking on field names and operators and typing in values.  These actions
  391. produce the Filter Command Line in the Main Box.  Let's look at each
  392. component of the Filter Requester in turn.
  393.  
  394. FIELD NAME PANEL
  395.  
  396. This appears on the left-hand side of the requester.  You can scroll the
  397. list of field names up and down in the usual way, using the scroll bar and
  398. arrows at the right of the Field Name Panel.  You specify that a field is
  399. to be used in the Filter by clicking on its name in this panel.
  400.  
  401. The list of field names is complete.  It's not affected by whether you have an Open Fields List, so the fields that specify the Filter neen not be the same as the ones that are shown in the Main Display.
  402.  
  403. OPERATORS
  404.  
  405. These appear to the right of the Field Name Panel, and can be divided into
  406. the Relational Operators, Logical Operators and Mathematical Operators.
  407. We'll see how these are used below.
  408.  
  409. VALUE BOX
  410.  
  411. This is the box with the word "Value" next to it.  You use it for typing
  412. in values such as names, numbers, and dates, which will form part of the
  413. Filter.
  414.  
  415. Always remember to press Return after typing in the Value Box.  You must do this to ensure that the contents are copied to the Main Box.
  416.  
  417. MAIN BOX
  418.  
  419. This is the long box that appears below the Field Name Panel and extends
  420. across the whole requester.  When you make selections with the mouse or
  421. type values into the Value Box, Superbase copies them into the Main Box,
  422. building up the Filter Command Line.  In this way you get immediate
  423. feedback about the results of your selections.  The maximum length of the
  424. Filter Command Line is much greater than the apparent length of the box --
  425. up to 255 characters are allowed.  You can type directly into the Main Box, but in these exercises we'll stick to making selections with the mouse.
  426.  
  427. USING THE OPERATORS
  428.  
  429. The Operators are the most complex aspect of the requester.  They are used
  430. to relate field names to other fields or values.  For example, if we wanted to set up a Filter to show only the addresses in West Germany, we would need the expression:  Country LIKE "West Germany".  Here, Country is a field name obtained by clicking in the Field Name Panel; LIKE is selected by clicking on the LIKE Operator button; and "West Germany" is typed into the Value Box.
  431.  
  432. TEXT STRING AND PATTERN MATCHING:  LIKE
  433.  
  434. When you're searching for names or text strings, uyou should avoid using
  435. the equals sign operator, and use LIKE instead.  This is because only LIKE
  436. accepts matches on either upper or lower case characters; it's said to be
  437. "case insensitive".  The equals sign operator, on the other hand, requires
  438. exact matches for what you type in:  It is "case sensitive".
  439.  
  440. LIKE also permits searches for text strings that include pattern matching
  441. characters.  these allow you to enter incomplete words for the Filter.  For example, to find all the records where the Lastname begins with "C" you need the Filter Command Line:  Lastname LIKE "C".  To specify a range add square brackets to the value:  Lastname LIKE"[A-D]*"; this finds all the records where the Lastname begins with "A", "B", "C", or "D".  Note that the Asterisk is placed outside the brackets.
  442.  
  443. There are several other things you can do with the LIKE operator.  You'll
  444. find a complete list and a number of examples in Appendix B.
  445.  
  446. THE RELATIONAL OPERATORS
  447.  
  448. =    This specifies that the field is to be EXACTLY EQUAL TO the following value or field:  Balance = 2000.
  449.  
  450. <>    The field is to be NOT EQUAL TO the following value or field: Country <> "France".
  451.  
  452. >    The field is to be GREATER THAN the following value or field: Balance > 1000.
  453.  
  454. <    The field is to be LESS THAN the following value or field: Balance < 1000.
  455.  
  456. >=    The field is to be GREATER THAN OR EQUAL TO the following value or field:  Balance >= 1000.
  457.  
  458. <=    The field is to be LESS THAN OR EQUAL TO the following value or field:  Balance <= 1000.
  459.  
  460. THE LOGICAL OPERATORS AND, OR AND NOT
  461.  
  462. Thes provide links between different expressions like the ones given above. You use them to specify alternatives and ranges for the Filter, either for a single field or for a number of interrelated fields:
  463.  
  464. AND    Both of the conditions linked by AND must be satisfied for the record to be accepted by the Filter:  Country "West Germany" AND Balance >= 5000.
  465.  
  466. OR    Either of the conditions linked by OR is sufficient to make the record aceptable to the Filter:  Country LIKE "West Germany" OR City LIKE "Geneva".
  467.  
  468. NOT    NOT is slightly different.  It negates the effect of an expression:  NOT (Country LIKE "West Germany" AND Balance > 5000).  This will find all the records other than the ones where the country is West Germany and the balance is greater than 5000.  Note the use made of Parentheses with NOT.
  469.  
  470. PARENTHESES
  471.  
  472. The ( and ) operators are used in the normal way, to give priority to one
  473. part of the expression over another.
  474.  
  475.     (    The following expression has a higher priority for evaluation 
  476. than the preceding expression.
  477.  
  478.     )    Required to end a higher priority expression.
  479.  
  480. The numbers of opening and closing parentheses must be equal.
  481.  
  482.  
  483. THE MATHEMATICAL OPERATORS
  484.  
  485.     +    This is used to express addition:  Balance > Amount + 1000.
  486.  
  487.     -    The minus sign expresses subraction:  Balance >  Amount - 1000.
  488.  
  489.     *    The asterisk is used for multiplication:  Balance > Amount * 1.15.
  490.  
  491.     /    The slash represents division:  Balance < Limit / 10.
  492.  
  493. TYPING IN THE MAIN BOX
  494.  
  495. The great power and flexibility of the Filter system is only achieved by
  496. giving the user control of every aspect of the operation.  Because you type into the Main Box you include all kinds of expressions which are not
  497. available from the buttons on the requester itself, and all kinds of text
  498. and numeric values.
  499.  
  500. The price you pay for this flexibility is an increased risk of making
  501. mistakes.  This is not too serious, as you cannot harm your data by using a Filter (although you can discard records using the Remove Records Filter). However, you may see a Superbase "Can't do this" message concerning an error in the Filter Command Line in two possible situations:
  502.  
  503. When you click an OK after creating or editing a Filter Command Line.
  504.  
  505. When you use a Filter after changing the definition of a field with Project Edit.
  506.  
  507. If you see a "Can't do this" message you must either change the Filter
  508. Command Line or change the file definition.  Here's a summary of the
  509. editing facilities available when typing inside the Main Box:
  510.  
  511. FILTER COMMAND LINE EDITING
  512.  
  513. You can remove everything from the Main Box by clicking on the Clear button.
  514.  
  515. If you have clicked in the box, hold down the right-hand Amiga Key (next to the space bar) and press X to delete its contents.  (Note:  we refer to this key combination as Amiga-X).
  516.  
  517.     Provided you have not left the box -- the cursor is still visible
  518. -- Amiga-Q will restore the contents you deleted with the Amiga-X.  This
  519. does not work after clicking on Clear.
  520.  
  521.     If Superbase won't let you make an Operator selection when you
  522. return to modify an existing Filter Command Line, click in the Main Box and press Return.  Now you can go ahead.
  523.  
  524.     Shift key and cursor right arrow and shift key and cursor left
  525. arrow move the cursor to the end and beginning of the Filter Command Line
  526. respectively.
  527.  
  528.     The DEL key romoves the character to the left of the cursor.
  529. Backspace repeats its action if held down.
  530.  
  531.  
  532. USING A FILTER
  533.  
  534. The Filter Command Line is made active by clicking on OK.  Whenever a
  535. Filter is in use, Superbase highlights the Flter button on the Control
  536. Panel.  You can perform all but one of the Control Panel record selection
  537. operations we've discussed, and Superbase will restrict the records
  538. displayed to the ones that match the Filter values.  For example, if you
  539. have specified the Country LIKE "West Germany" and you click on the First
  540. Record button, Superbase will go and find the first record in the file,
  541. according to the current index, which has the value "West Germany" in the
  542. Country field.
  543.  
  544. The Key Lookup button is an exception to the filter effect.  You can still
  545. recall individual records by entering an index key value, whether or not
  546. they match the Filter.
  547.  
  548. SUSPENDING A FILTER
  549.  
  550. There wil be times when you want to remove the Filter effect so that you
  551. can review all the records in the file again.  To do this, just click on
  552. the highlighted Filter button.  It reverts to normal, and you'll find that
  553. when you use the Control Panel Superbase acts as if there were no Filter.
  554.  
  555. MODIFYING OR RE-ACTIVIATING A FILTER
  556.  
  557. If you've set up a Filter and then suspended it, you can bring it back into operation by clicking once more on the Filter button.  Superbase displays the Filter requester, with the Filter Command Line in the Main Box just as you left it.
  558.  
  559. If you want to, you can add to the Filter Command Line by clicking on more
  560. field names and oeprators (you may need to click in the Main Box and press
  561. Return first), or edit it after clicking in the Main Box, as described
  562. above.
  563.  
  564. Whether you've made any changes or not, just click on OK to use the Filter
  565. again.
  566.  
  567. FIFTEEN MINUTE TUTORIAL
  568.  
  569. Make sure you've got the Addresses file open, indexed on Lastname.  Set
  570. Table View with Paging off.  Go into Project Open Fields and open these
  571. fields:
  572.  
  573.     Forename
  574.     Lastname
  575.     Street
  576.     City
  577.     Country
  578.  
  579. In Table View, drag the Lastname column a few columns to the left, and then do the same for City, overlapping the Street column if necessary, until the Country column comes into view.
  580.  
  581. Click on the Filter button.
  582.  
  583. We are going to search for those name and address records where the person
  584. lives in the USA or West Germany.  So we'll use the Country field, and LIKE operator, and the Value Box.  You'll see the results of your selections appear as a Filter Command Line in the Main Box.
  585.  
  586. Move the pointer into the Field Names Panel, and click once on the down
  587. arrow to bring Country into view.  Then click on Country.  The name appears in the Main Box.  Next, move the pointer to the right and click on the LIKE button.  This also appears in the Main Box.  Now you must type in "USA". This goes in the Value Box.  Move the pointer into the Value Box and click on the mouse to produce the cursor.  Type in "USA" (no quotation marks). Press Return -- this is essential, or the contents of the Value Box will not be copied into the Main Box.  Your Filter Command Line should read:
  588.  
  589. Country LIKE "USA"
  590.  
  591. Next, you need the OR operator.  Click on it and Superbase copies it into
  592. the Main Box.  Now you must click on the Country field name again.  This is important.  A Filter Command Line like this is not allowed:
  593.  
  594. Country LIKE "USA" OR "West Germany"
  595.  
  596. So, click on Country, as before, followed by LIKE.  Then, as before, click
  597. in the Value Box, and type in "West Germany".  Press Return.  Your Filter
  598. Command Line should look like this:
  599.  
  600. Country LIKE "USA" OR Country LIKE "West Germany"
  601.  
  602. If there are any mistakes click on Clear and repeat the steps above until
  603. you get it right.
  604.  
  605. You have built your Filter Command Line, so now you can put it into action. Click on the OK button.  Superbase activates your Filter and displays the first record in the file that matches the Filter.  Click on Fast Forward. Superbase shows all the records that match the Filter.
  606.  
  607. Now de-activate the Filter.  Click on the Filter button so that it's not
  608. highlighted.  Now click on Rewind.  You'll see all the records in the file
  609. appear as normal.
  610.  
  611. Let's go back and add another condition.  Click on the Filter button to
  612. recall the requester.  Click on the OR operator, then on Country, then on
  613. LIKE, then in the Value Box, type in "France", and press Return.  Your line should read:
  614.  
  615. Country LIKE "USA" OR Country LIKE "West Germany" OR Country LIKE
  616. "France".
  617.  
  618. Now click on OK and when Superbase shows the first record, click on Fast
  619. Forward.  You will see that Superbase has added the addresses in France to
  620. the display.
  621.  
  622. That concludes our short tutorial.
  623.  
  624. OTHER FILTER BASED OPTIONS
  625.  
  626. You should have acquired a feel for the way the Filter requester works,
  627. and you can experiment freely with the Addresses file to deepen your
  628. knowledge.  When you're ready, you can start using the Process options, all of which are selected from the Process menu.
  629. SUPERBASE PROFESSIONAL DATABASE MANAGEMENT LANGUAGE USER GUIDE
  630.  
  631. BEFORE YOU BEGIN...
  632.  
  633. This Volume presents you with two user guids, one for Superbase's Database
  634. Management Language(DML)and one for the Forms Editor. Although they are both under the same cover, they can be treated as separate manuals. Each has its own Contents, Index, chapter numbers and page numbers.
  635. Note that the Forms Editor is a separate program from Superbase Professional.
  636. You will find instructions on how to install and load it on your computer in
  637. the Readme document which is supplied on the demonstration file disk. If you
  638. haven't done so already, you should read this document now. It also provides
  639. details of any features of Superbase Professional that are not covered in
  640. either Volume 1 or 2.
  641.  
  642.              CHAPTER 1 - INTRODUCTION TO DML
  643.  
  644. Welcome to Superbase Professional's Database Management Language(DML). DML is
  645. based on the programming language Basic. It includes most of the standard Basic commands and functions, but supplements them with a large number of commands and functions that are specific to database management.
  646. The database commands duplicate the controls that Superbase Professional
  647. provides through its menus and dialogs. This means that almost all of
  648. Superbase's file and record handling facilities are available under program
  649. control. In fact, apart from Fast Forwards, Rewind and Duplicate, you can now
  650. carry out any Superbase operation using a single program command.
  651. Once you have familiarized yourself with Superbase's controls, the corresponding program, you may find the idea of learning a program language daunting. But as far as DML is concerned, a little goes long way, and you do not need to be fully conversant with the language in order to take advantage of it. In effect, you are already following a program sequence every time you perform a task which involves a series of menu operations. Writing a program that performs the task for you is simply a matter of entering commands in the same sequence. Generally, you will be able to find a single command to duplicate each of the menu operations.
  652. As you acquire more expertise, you can move on, building bigger and more complex programs by combining routines, until you have fully automated your database system. When you're ready, you can incorporate Superbase forms into your programs, taking advantage of their built-in facilities for generating and retrieving records in several files at once.
  653. At the highest level, you can specify your own pull-down menus, replacing the
  654. standard Superbase menus with the options that are relevant to the job in hand. And you can customize your application to an even more detailed level by creating your own pop-up selection panels to guide the user's choices.
  655.  
  656. USING THIS GUIDE
  657. Before reading this guide, you will need to be familiar with Superbase's menu
  658. and keyboard controls. Many of DML's commands provide a program equivalent of a menu or keyboard option, and the descriptions given here presume that you
  659. already know how to use the corresponding option. However, once you have mastered Superbase itself, you do not need to read this book all the way through. As a reference guide, it can be consulted as and when it is needed.
  660.  
  661.             CHAPTER 2 - OVERVIEW
  662.  
  663. OPERATING MODES
  664. DML has two modes of operation:direct mode and program mode.
  665.  
  666. DIRECT MODE
  667. In this mode, DML executes instructions as soon as you have typed them in. First you need to select the Command option from the Program Menu. Then enter your instructions - a single command or a line of commands separated by colons - in the command line window;when you select 'OK' or press the Return key, DML will carry out the instructions straight away. The command line window is 64 characters long but you can enter up to 255 characters and move within the window using the cursor keys.
  668.  
  669. PROGRAM MODE
  670. In program mode, DML does not execute commands as you enter them. Instead they are stored in memory and executed only when the program is run. The main
  671. difference between this mode and direct mode is that with the latter you can
  672. only enter and execute one line at time;program mode allows you to enter a
  673. series of instruction lines which are carried out in sequence. Program lines
  674. can be up to 255 characters long.
  675.  
  676. OTHER DML APPLICATIONS
  677. DML's functions, along with its operators and variables, can also be used in
  678. other Superbase operations - such as field definition validations and
  679. calculations, filter conditions, update commands and query derived field
  680. definitions.
  681.  
  682. KEYWORDS AND RESERVED WORDS
  683. Any word that DML recognises as a specific instruction, or part of an
  684. instruction, is known as a keyword. A keyword cannot be used as a variable name,  a field name,  or a label. In this context, keywords are also knows as reserved words - DML reserves them for its own use, and will interpret then as such even if they are in lower case. A reserved word can, however, from part of a name. For example,  you can incorporate the reserved word TO in any of the following ways:
  685. TOP:        (in a label)
  686. TOTAL%        (a numeric variable)
  687. tot$        (in a string variable)
  688. TOTALS$        (in a field name)
  689.  
  690. But you cannot use it like this:
  691. TO:
  692. TO%
  693. TO$
  694.  
  695. COMMANDS AND STATEMENTS
  696. Some programming manuals make a strict division between two kinds of executable instructions - commands and statements. Commands are those instructions which are generally executed in direct mode, while statements are instructions that can only appear in a program line.
  697. In DML there are only a few instructions that cannot be used in both operating modes and so the two terms are used almost interchangeably. Thus we refer to a line with more than one instuction on it as a multi-statement line; but it could equally well be called a multi-command line.
  698.  
  699. VARIABLES
  700. There are three types of variables in DML:string variables,  numeric variables, and arrays. In many circumstances, the fields in a Superbase file can also be treated in the same way as variables.
  701.  
  702. VARIABLE NAMES
  703. Numeric variables must end with the '%' character, string variables end with an '$' character. Apart from this, the names for both types of variable follow the same rules:
  704. Variable names have a maximum length of 14 characters and a minimum length of 1 character(excluding '%' or '$'). The first character of the name must be a letter in the range 'a' to 'z' but the remaining characters can be either alphabetic or numeric. DML is not case sensitive; 'abc%' is the same as 'ABC%', and 'abc$' is the same as 'ABC$'. A variable name can contain a reserved word, but cannot consist of just a reserved word and the variable suffix, % or $. For example, names like 'lef$',  'cos%', 'report$' and 'FILE%' are forbidden. See Appendix A for the list of reserved words. Before using a variable, you must define it by assigning a value to it. This means that the first occurrence of a variable should be in an assignment statement, with the variable to the left of the equal sign. Suppose, for example,  you instructed DML to display the value of a$, using the command
  705.     ? a$
  706. If you have not assign a value to a$ beforehand, DML will issue the error
  707. message:
  708.     Can't do this
  709.     Variable not defined
  710. To avoid this error message, you would have to define a$ at an earlier stage in the program, with line such as
  711.     a$="Hello"
  712. or
  713.     a$=""
  714. The double quotes are known as the 'empty string'. They allow you to define a
  715. string variable without actually assigning a specific value;they are also used to clear the contents of string variables.
  716. There are,  however,  a number of exceptions to the rule about defining variables. Some statements - READ, ASK, WAIT, and INPUT - define variables implicitly when they are used for the first time. Thus DML would accept the line: 
  717.     READ a$
  718. even if you had not assigned a value to a$ previously.
  719.  
  720. NUMERIC VARIABLES
  721. DML's numeric variables hold numbers at 13 figure accuracy, but if displayed or printed, they are shown in the current default numeric format. Note that there is only one type of numeric variable. In some versions of Basic, the % suffix indicates that the variable can only store whole numbers(integers):in DML,  the same numeric variable can be used for both whole numbers and floating point numbers.
  722.  
  723. STRING VARIABLES
  724. String variables are used to hold ASCII characters - usually alphanumeric text. The maximum length of data that can be held in a string variable is 255
  725. characters.
  726.  
  727. ARRAYS
  728. DML supports string and numeric arrays with up to three dimensions.
  729. The maximum number of elements in an array is limited only by the amount of
  730. memory available. The rules for array names are the same as those for numeric and string variables. Numeric arrays must end with '%' character, string arrays must end with '$' character.
  731.  
  732. SYSTEM VARIABLES
  733. TODAY, NOW and ERRNO are variables which are supplied by DML. TODAY gives the
  734. system date, NOW gives the system time. DML treats these in the same way as date and time fields;that is, although they are numeric variables, they are displayed in the current date or time format. If the time of day is 9:41 and the system clock has been set to this time. NOW would display it as 9:41. But it stores this as 34919810 - the number of thousandths of a second from midnight to 9:41. ERRNO returns the number of the last error that occurred.
  735. You cannot assign a value to a system variable, but otherwise TODAY, NOW and
  736. ERRNO can used in the same way as any other numeric variable.
  737.  
  738. FILE TYPES
  739. When you save a file using one of the SAVE options, DML automatically adds one of the following extension names to the file name:
  740.     aaa.sbf is a database file
  741.     aaa.sbd is a file definition for a database file
  742.     aaa.sbk is a function key file
  743.     aaa.sbp is a program file
  744.     aaa.sbq is a Query file
  745.     aaa.sbt is a text file saved from the text editor
  746.     aaa.sub is an Update file
  747.     aaa.### is an index(where ### is a number from 001 to 999)
  748. DML stores program files, Text Editor files, database files and index files in its own format(for example, it tokenizes keywords in program files and stores formatting information with documents saved in the Text Editor). The others are all text files and only contain ASCII characters.
  749.  
  750. FIELDS
  751. With a few exceptions, you can use fields in the same way as variables. For
  752. instance, you can input data directly to fields;you can supply a field name as the argument for a function;and you can assign values to fields.
  753. Fieldnames must conform to the rules for field names as set out in Volume 1, 
  754. i.e.:
  755.     The maximum length is 15 characters.
  756.     The minimum length is one character.
  757. They must begin with an alphabetic character, but can thereafter contain any
  758. alphanumeric characters. They can also contain the underscore and space
  759. characters. Superbase will accept a field name with several spaces embedded in it - i.e., 'a bc d' is a valid name - but this is not recommended.
  760. DML is not case sensitive;'abc' is the same as 'ABC'.
  761. The file a field belongs to must be open;otherwise the following requester
  762. appears:
  763.     Can't do this....
  764.     'field name'
  765.     Can't find this field
  766. Where more than one file is open and there are two files with the same field
  767. name, the file name must be given as an extension to the field name and the two must be separated by a full stop. This enables DML to identify the field you are referring to.
  768. NOTE:FAILING TO SUPPLY FILE EXTENSION NAMES TO FIELDS MAY RESULT IN INCORRECT
  769. DATA, ALTHOUGH IT DOES NOT CAUSE AN ERROR.
  770. If the file name contains spaces, it must be included within quotation marks, 
  771. e.g.:
  772.     fielda.filea
  773.     name.Customers
  774.     Lastname."Customer File"
  775.  
  776. DATE AND TIME
  777. Superbase stores dates as julian date numbers;that is, as the number of days
  778. from 31st December in the year zero. This means that date fields are numeric
  779. fields and hold their dates as numbers. When you display a date field, however,  Superbase automatically converts it to a more recognizable format:it takes the format which has been set in the file definition(see Chapter 2, Volume 1). The date format only controls the way dates are displayed. You can enter a date from the keyboard in almost any format. For instance, the date might be shown on screen as 24/02/87, but you can type in a date like '28 February, 1962' and DML will accept it.
  780. Incidentally, DML does remember that eleven days were lost when the Gregorian
  781. Calendar reform was implemented(September 2nd, 1752 is followed by September
  782. 14th). As with dates, DML stores the time in time fields as a numeric value,  but displays it in a different format. The time is stored as the number of
  783. thousandths of a second from midnight. When you display the time, it is given in hours and minutes in either 12 or 24 hour format.
  784.  
  785. FUNCTIONS
  786. Functions form one of the largest groups of DML keywords. Most of them perform a calculation on a number or a string, but there are also functions that give information about some aspect of the system. RECCOUNT, for example returns the number of records in a file, and FREE returns the amount of free memory space. Unlike a command, a function cannot be entered on its own as a statement. Thus:
  787.     ? RECCOUNT("address")
  788.     NUMRECS%=RECCOUNT("address")
  789. are valid statements, but
  790.     RECCOUNT("address")
  791. produces an error message.
  792. All functions take an argument, which is enclosed in parentheses, and return a result. If the function calculates a result, the argument is what it works on.
  793. In the example above, "address" is the argument. It tells the function which
  794. file to count.
  795. Depending on the funcion, the argument(or arguments)may be a field name, a file name, constant, a variable, or a combination of these connected by an operator to form an expression. You will find details of what kind of argument a function expects,  in the Keyboard Reference section.
  796. Although functions are usually classed as either string or numeric functions, 
  797. this does not always guarantee that they take a particular kind of argument.
  798. Numeric functions always take numeric arguments, but some string functions also expect a numeric argument. CHR$, for example, returns a string result from a numeric argument.
  799. When it comes to finding out what type of result a function returns, there is a simple rule you can apply. Functions which have a $ character at the end,  return their results as string data;if they do not end in a $, they return a numeric result. There is one exception to this rule - REPLICATE,  which returns a string result,  despite the fact that it does not have a $ at the end.
  800.  
  801. OPERATORS
  802. DML provides three types of operators:arithmetic, relational and string.
  803.  
  804. ARITHMETIC OPERATORS
  805. Addition
  806. The plus sign specifies that the operand on the right is added to the operand
  807. on the left, e.g.:
  808.     2 + 2
  809.     a% + b% + c%
  810.     a% + 12.225
  811.  
  812. Subtraction
  813. The minus sign specifies that the operand on the right will be subtracted from the operand on the left e.g.:
  814.     -3
  815.     -a%
  816. Multiplication
  817. The asterisk is recognised by DML as the multiplication symbol and specifies
  818. that the operand on the left is multiplied by the operand on the right, e.g.:
  819.     3 * 2
  820.     a% * b%
  821.     a% * 12.225
  822. Division
  823. The slash is recognized by DML as the division symbol and specifies that the
  824. operand on the left is divided by the operand on the right, e.g.:
  825.     3 / 2
  826.     a% / b%
  827.     a% / 12.225
  828. NOTE:UNLIKE IN MANY OTHER PROGRAMMING LANGUAGES, DIVISION BY ZERO DOES NOT CAUSE AN ERROR MESSAGE AND RETURNS A VALUE OF ZERO. THIS,  OF COURSE,  IS A FALSE RESULT,  AND YOU SHOULD CHECK NUMERICAL DATA TO ENSURE IT DOES NOT OCCUR.
  829. Exponentiation
  830. The up arrow(or caret)is recognized by DML as the exponentiation symbol and
  831. specifies that the operand on the left is raised to the power specified by the operand on the right(the exponent);that is, the operand on the left is
  832. multiplied by itself the number of times specified by the exponent. If the
  833. exponent is 2, the number is squared;if the exponent is 3, the number is cubed; if the exponent is 1/2, the square root of the number results, e.g.:
  834.     3 ^ 2            (3 squared)
  835.     a% ^ b%        
  836.     a% ^ 12.225
  837.     a6 ^ 0.5        (the square root of 16)
  838.     27 ^ 0.33333333        (the cuberoot of 27)
  839.     3 ^ -2            (1/3 * 1/3)
  840. Modulo arithmetic
  841. MOD gives the remainder when the operand on the left is divided by the operand to the right, e.g.:
  842.     17 MOD 7        (returns 3)
  843.     a % MOD b%
  844. Parentheses
  845. Parentheses are used to change the order in which the different parts of an
  846. expression are calculated. Without parentheses, expressions are evaluated in a certain order which depends on the operators they contain - some operators have precedence over others(see the Table of Precedence). For example,  multiplication has precedence over addition; so,  in the expression:
  847.     3 + 4 * 2
  848. the 'four times' part is worked out first and then added to 3, giving 11 as the result. You could alter this by enclosing '3 + 4' in parentheses:
  849.     (3 + 4) * 2
  850. to give a result of 14.
  851. Parentheses must always be paired - each '('should have a matching')'.
  852.  
  853. Concatenation
  854. When used with strings or string variables, the plus sign causes the string
  855. specified by the right operand to be appended to the string specified by the
  856. left operand, e.g.:
  857.     "ABCD" + "defg"            evaluates as "ABCDefgh"
  858. Used in this way, the plus sign acts as a string operator.
  859.  
  860. RELATIONAL OPERATORS
  861. Relational operators compare the values of two numbers or two strings, and
  862. return a result which is either true or false. They are mainly used with IF
  863. THEN and WHILE WEND statements to make a decision about whether the program
  864. takes a particular action or not. For example:
  865.     IF n% > 30 THEN GOSUB label
  866. The relational operators are:
  867.     >        greater than            12>55 is false, i.e.0
  868.     =        greater than or equal to    
  869.     <        less than
  870.     <=        less than or equal to        27<=27 is true, i.e.-1
  871.     <>        not equal to            1=5-4 is true, i.e.-1
  872.     =        equal to
  873.     LIKE        pattern matching operator for strings.
  874.     CONTAINS    pattern matching operator for text files.
  875.  
  876. As far as the user is concerned the result of comparison is either true or
  877. false. But when DML comes to evaluate a comparison, it actually assigns a
  878. numeric value to the result. If the result is true,  DML assigns it the value of -1; if false, it assigns the value of 0. This means that if you enter the
  879. statement:
  880.     ? 8>5
  881. or
  882.     ? "F"=LEFT$("FRIDAY", 1)
  883. DML will display -1. If the result of a comparision is false, it will display 0. For string operands, comparison is character by character from the left where 'a' is less than 'b' is less than 'c' and upperacase characters are less than lower case characters ('A" is less than 'a'). Note that numeric data can only be compared with numeric data and string data can only be compared with string data. If you attempt to compare numeric data with string data then the message:
  884.     Can't do this/Data types don't match
  885. appears.
  886.  
  887. LIKE
  888. LIKE is a case insensitive pattern matching relational operator which is used
  889. to compare string data. The question mark '?' and asterisk '*' characters can
  890. be used as wildcards. The question mark matches single characters and the
  891. asterisk '*' matches multiple characters.
  892. For a full explanation of how to use LIKE, see Volume I, Appendix B.
  893.  
  894. CONTAINS
  895. CONTAINS works in the same way as LIKE, but it used with ASCII files on disk; for example,  you could use the expression:
  896.     CONTAINS "*Smith*"
  897. to search for an ASCII file which contained the name Smith. See Chapter 9, 
  898. Volume 1, for more details.
  899.  
  900. LOGICAL OR BOOLEAN OPERATORS.
  901. Logical operators are most frequently used to modify the results of relational operators. An expression that contains a relational operator can either be true or false. With a logical operator you can create more complex expressions whose truth or falsity(their 'truth value')depends on the truth or falsity of one or more relational expressions.
  902.  
  903. AND
  904. This operator allows you to test whether two comparisons are true at the same
  905. time. For example:
  906.     12 > 5
  907. and
  908.     6 < 16
  909. are both true, so
  910.     12 > 5 AND 6 < 16
  911. is also true.
  912.  
  913. NOT
  914. NOT reverses the truth or falsity of an expression. Thus:
  915.     12 < 5
  916. is false, so
  917.     NOT 12 < 5
  918. is true.
  919. NOT is often used with the EOF function to set up a program loop for processing all the records in a file, e.g.:
  920.     WHILE NOT EOF("address")
  921.     SELECT NEXT
  922.     VIEW
  923.     WEND
  924. OR
  925. OR gives a true result if one or the other,  or both,  of its operands is true. For example:
  926.     12>5 OR 12<5
  927.     8=2*3 OR 6>5
  928.     8=2*4 OR 6<5
  929. all give true results.
  930.     12>5 OR A$="LONDON"
  931. gives a true result whatever the value of A$.
  932.     8=2*3 OR 12<5
  933. gives a false result.
  934. Logical operators can also be used with numeric expressions to give a result
  935. which depends on the binary digits of the operands. In this context, they are
  936. sometimes known as bitwise operators. Instead of comparing the truth or falsity of expressions, AND and OR - when used as bitwise operators - compare the binary digits of two numbers, while NOT takes a single number, and changes each binary 1 to 0, and vice versa. Thus AND returns binary 1, if and only if, the corresponding digits in the two operands are both 1, e.g.:
  937.     85 AND 19
  938. gives a value of 17.
  939.  
  940.                 2-12
  941.  
  942.     85 in binary is 01010101
  943.     19 in binary is 00010011
  944. The result is 00010001 which is 17
  945.  
  946. TABLE OF PRECEDENCE
  947. Complex expressions, containing more than one operator and several simple
  948. expressions, are evaluated according to the following table. The higher up the table an operator is, the higher the precedence it is given. This means that if there are two simple expressions, the one whose operator has the highest precedence will be evaluated first.
  949.     ^        Exponentiation
  950.     */        Multiplication and Division
  951.     MOD        Modulo arithmetic
  952.     +-        Addition and Subtration
  953.     <> <=> =    Relational operators
  954.     LIKE CONTAINS    Relational operators
  955.     NOT        Logical NOT
  956.     AND        Logical AND
  957.     OR        Logical OR
  958. Where identical weighted operators are concerned evaluation will be from left
  959. to right e.g.:
  960. 12 + 3-2    is evaluated as    12 + 3=15 : 15-2=13
  961. 12 + 3*4    is evaluated as    3 * 4=12 : 12 + 12=24
  962. 12 + 3*4-2    is evaluated as    3*4=12 : 12 + 12=12: 24-2=22
  963. Parentheses can be used to promote expressions up the table, e.g.:
  964. (12+3) * (4-2)  evaluates as   15*2=30
  965.  
  966. CONSTANTS
  967. The fixed values that you assign to variables or use as part of an expression
  968. are known as constants. There are two types:string constants and numeric
  969. constants. String constants must be enclosed in quotation marks.
  970. DML also provides a ready-defined constant PI, which has the value of
  971. 3.141593265359 and can be used in numeric calculations.
  972.  
  973. EXPRESSIONS
  974. Expressions are formed from any combination of:
  975. Fields
  976. Variables
  977. Constants
  978. Functions
  979. Operators
  980. An expression can consist of a single variable name, a field name, or a constant, or it may be more complex, combining these with operators, constants and functions. The following are examples of expressions:
  981. 396
  982. TODAY
  983. a$
  984. "31 Ambleside Drive"
  985. textfielda
  986. numfielda
  987. Firstname.address
  988. LEFT$(Firstname.address, 1)
  989. 3.44*22.8 + 450
  990. "Mr" + A$
  991. A$ + B$
  992. a%<>b%
  993. (a$=b$)AND(c%=1)
  994. INT(RND(1)*26)+1
  995. COS(n%)
  996.  
  997. LINE FORMAT AND LABELS
  998. There are no line numbers in DML;instead, to provide a reference for GOTO and
  999. GOSUB commands(or ON GOTO and ON GOSUB commands)you can place a label at the
  1000. front of a line. Labels can be any combination of alphanumeric characters but
  1001. cannot contain spaces.
  1002. Labels must end in a colon (':')unless they consist only of numeric characters.
  1003. You can use a number as a label without adding a colon, but this will not have the effect of altering the sequence of program lines. So, if you enter a line with the label '30' after a line with the label '50', both lines will remain in that order.
  1004. A DML line, whether in direct mode or program mode, can contain more than one
  1005. statement, provided the statements are separated by colons.
  1006. Labels, however, can only be used in program mode.
  1007. Any command which is placed at the beginning of a multi-statement line should
  1008. be followed by a space. If it is followed by a colon without an intervening
  1009. space, DML may interpret it as a label. For example, in the line:
  1010.     CLS:STATUS
  1011. the command CLS has no effect, but
  1012.     CLS:STATUS
  1013. works as intended.
  1014. You also need to insert a space before an expression - a variable name or a
  1015. field name, for example - if it is preceded by a DML command word. But otherwise in program mode, DML will accept lines without any spaces in them (it inserts spaces when it parses a line).
  1016. In direct mode, it is generally necessary to insert spaces between the various elements of a command line.
  1017.  
  1018. SYNTAX
  1019. The Keyword Reference section gives the exact syntax for each keyword. However, there are several rules that apply generally.
  1020.  
  1021. FILE NAMES AND FIELD NAMES
  1022. Wherever a command is followed by a file name - or takes a file name as one of its arguments - the file name must be enclosed in quotation marks.
  1023. Fieldnames should not be in quotation marks.
  1024. For most operations, you should not include the extension name for a file(the
  1025. part of the name after the full stop). Superbase automatically looks for files with the appropriate extension;so, with the command:
  1026.     OPEN FILE "Address"
  1027. it looks for the file "Address.sbf".
  1028. The one exception to this rule is when you are dealing with text files. OPEN
  1029. FOR INPUT/OUTPUT, OUTPUT TO, IMPORT and EXPORT all take data to or from text
  1030. files, and require that file names are given in full.
  1031. If you save a file from Superbase's text editor, it automatically adds an '.sbf' extension to the file name - and when you open a file from the text editor, you do not need to supply the '.sbt' extension. But when you make use of a text editor file in some other applications - with IMPORT, for example - you must remember to include the .sbt extension. By the same token, you will not be able to load text files into the text editor unless you give them a .sbt extension.
  1032.  
  1033. UPPER CASE AND LOWER CASE
  1034. Certain string functions such as INSTR are case sensitive, but otherwise DML
  1035. ignores the difference between lower and upper case letters(small letters and
  1036. capital letters). In other words, it does not matter whether you use lower or
  1037. upper case letters when you type in a keyword or any of the following:
  1038.     variables
  1039.     file names
  1040.     field names
  1041. It is a good idea, though, to enter program lines and direct command lines in
  1042. lower case. Once DML has accepted a line, it converts any reserved words (that is, any keywords) to upper case. Typing in lower case allows you to check that you have not used a reserved word by mistake.
  1043.  
  1044.             CHAPTER 3 - THE PROGRAM EDITOR
  1045.  
  1046. THE PROGRAM MENU
  1047. Operations relating to programs and programming are controlled from a single
  1048. menu at the right of the menu bar, the Program menu. This section lists the
  1049. Program menu options, and gives a brief explanation of their functions. Apart
  1050. from Print and Remove (which should not require further explanation), each option is also described in more detail in the sections that follow.
  1051.  
  1052. COMMAND    Opens the Command line window, allowing the user to enter program
  1053.     instructions as direct commands.
  1054. RUN    Runs the program in memory or, if there is no program in memory, loads a
  1055.     program from disk and runs it.
  1056. NEW    Opens the Program Editor window and clears any program that may be in
  1057.     memory.
  1058. EDIT    Opens the Program Editor window.
  1059. OPEN    Loads a program from disk into memory.
  1060. CLOSE    Clears the program in memory - the program that is currently in the
  1061.     Program Editor - and closes the Program Editor window.
  1062. SAVE    Saves the program in memory to disk.
  1063. PRINT    Prints the program in memory.
  1064. REMOVE    Deletes a program file from disk.
  1065.  
  1066. THE PROGRAM EDITOR WINDOW
  1067. When you select Edit or New from the Program menu, Superbase opens a window at the right-hand half of the screen. This is the program window where you enter and edit programs.
  1068. In most respects, the program window can be treated in the same way as the text window: you use the same controls for closing, resizing and moving the window(as explained in Chapter 10, Volume 1); and you also use many of the same key controls for editing a program. In fact, both the Program Editor and the Text Editor make use of the same window. The window can only be occupied by one of them at a time, but any changes you make to the size or location of the window will apply when you switch to the other editor.
  1069. The main difference between the two is that the Program Editor does not have
  1070. its own set of menus. The Program menu is available at all times - except when the Text Editor menus are active - whether the program window is open or
  1071. closed.
  1072. As with the Text Editor, you can switch between the program window and the
  1073. database window simply by moving the mouse pointer to the required window and
  1074. clicking in it. Thus, to edit a record after opening the program window, you
  1075. would click twice in one of the fields displayed in the database window - once to make the database window active, and once to activate the record editing cursor(on the Amiga, you would only need to click once). If you then wanted to return to the Program Editor, clicking once in the program window would make the program cursor active again.
  1076. Notice that the Close option on the Program menu not only closes the window but also removes the current program from memory. If you wish to close the window without clearing the program from memory, click on the close window gadget at the top left-hand corner.
  1077. NOTE: Screen output from a Superbase program is displayed in the database
  1078. window. If there is a record in view, program data will be output below or to
  1079. the right of the bottom line of record data. To clear the database window
  1080. before displaying program data on screen, use the CLS command.
  1081.  
  1082. CREATING A NEW PROGRAM
  1083. Selecting Edit from the Program menu opens the program window and places the
  1084. program cursor at the top left-hand corner. When you enter the Program Editor
  1085. for the first time in a session, the window will be empty;you can then start
  1086. entering program lines straight away. If you have previously loaded a program
  1087. into memory and want to start afresh on a new program, select New to clear the existing program from memory.
  1088. Entering program lines is simply a matter of typing them in at the keyboard.
  1089. When you have typed in a line, pressing the Return key will take you to the
  1090. start of the next line.
  1091. Superbase accepts program lines up to 255 characters long. As you type
  1092. characters beyond the right-hand edge of the window, the program will be
  1093. scrolled to the left. Using the scroll bars enables you to move the window over any part of a line up to 255 characters.
  1094.  
  1095. LINE FORMAT
  1096. An explanation of the correct format for a Superbase program line is given in
  1097. Chapter 2, Line Format and Labels. However, it is worth repeating th rule about inserting spaces in a line:you need to insert a space if you enter an
  1098. expression - such as a variable name, a field name, or a constant - after a
  1099. keyword, or if you enter two adjacent keywords. In the following example, the
  1100. space between the two items on the line must be entered by the user:
  1101.     ? "Hello"
  1102. You should also type a space between a command and a colon if the command is
  1103. placed at the start of a multi-statement line. If you do not do this, DML will interpret the command as a label.
  1104. Otherwise, you can ignore spaces as you type in a program. If a line contains
  1105. adjacent variables or operators and other elements of an expression, DML inserts spaces between them when it 'parses' the line.
  1106. Parasing refers to the process which takes place when you press Return or move the cursor away from the current line. DML scans the line and identifies the various elements in it. As well as inserting spaces between recognizable
  1107. elements, it also converts any keywords that are entered in lower case to upper case. Thus if you typed:
  1108.     if a%=3.5+6then goto label1
  1109. DML would parse this line as:
  1110.     IF a%=3.5+6THEN GOTO label1
  1111. You are recommended to enter program lines in lower case as a way of ensuring
  1112. that you do not use reserved words as labels or variables. When a line is
  1113. parsed, you will be able to see at a glance whether these items are correct, 
  1114. because the reserved words will be shown in upper case.
  1115. It is unlikely that you will need to create programs with lines over 200
  1116. characters long. However, if you do, it is important to bear in mind that spaces may be inserted in the line. Even though the line you type in is less than 255 characters, it may exceed this limit when it has been parsed.
  1117.  
  1118. EDITING A PROGRAM
  1119. The Program Editor uses the same key controls for editing a program and moving the cursor around the screen as the Text Editor. As you would expect, it is not possible to specify margins or reformat a program;and the style setting functions are not available. Otherwise, the only difference is in the way the Return key works. In the Text Editor, Return either moves the cursor to the start of the next line or creates a new line, depending on whether overwrite or inset mode has been selected.
  1120. In this section, we only provide a list of the Program Editor key controls
  1121. together a brief description of their functions. For a detailed explanation of these keys, see Chapter 10, Volume 1. The '^' character is used here to represent the CTRL key; ^N for instance, indicates that the CTRL key and the letter N should pressed in combination.
  1122.  
  1123. MOVING THE CURSOR
  1124. As with the Text Editor, you can move the cursor around the screen and edit a
  1125. program at any point on the screen.
  1126. The cursor keys are used to move the cursor by one character at a time. Note
  1127. that the term character includes the space character.
  1128.  
  1129. LEFT ARROW        Moves the cursor to next character to the left.
  1130. RIGHT ARROW        Moves the cursor to the next character to the right.
  1131. UP ARROW        Moves the cursor to the character in the same column
  1132.             on the line above.
  1133. DOWN ARROW    Moves the cursor to the character in the same column
  1134.             on the line below.
  1135.  
  1136. For larger cursor movements, use the following keys:
  1137. ^B            Takes the cursor to the first line in the text.
  1138. ^G            Takes the cursor to the last line in the text.
  1139. Shift right cursor(Amiga)  Moves the cursor to the beginning of a line.
  1140. Shift left cursor(Amiga)  Moves the cursor to the end of a line.
  1141. Tab            Moves the cursor eight characters to the right.
  1142. Shift Tab        Moves the cursor eight characters to the left.
  1143. Control T        Moves the cursor eight characters to the left.
  1144.  
  1145. DELETING AND INSERTING
  1146. The following keys are used for deleting and inserting program lines or parts
  1147. of a program line:
  1148.  
  1149. BACKSPACE        Delete character to the left of the cursor.
  1150. DEL            Delete character to the right of the cursor.
  1151. ^W            Delete word.
  1152. ^E            Delete to end of line.
  1153. ^D            Delete line.
  1154. ^X            Clear line.
  1155. ^N            New line.
  1156. ^S            Split line.
  1157. ^A            Join line.
  1158. ^V            Insert mode on/off.
  1159. ^U            Undo.
  1160.  
  1161. Note that Undo works in the same way as in the Text Editor, and can be used as a 'cut and paste' facility, allowing you to move mutiple program lines to a new position.
  1162.  
  1163. USING THE COMMAND LINE
  1164. Selecting the Command option on the Program menu presents you with the DML
  1165. Command Line dialog. Any commands you type in the command line box will be
  1166. executed as soon as you click on OK or press Return;that is, they will be
  1167. executed as direct commands.
  1168. The command line box accepts single or multi-statement lines(with statements
  1169. separated by colons)up to 255 characters. You can type in commands when ever
  1170. the cursor is present. If the cursor is not shown, click in the box to activate it.
  1171. There is very little restriction on which keywords can be entered as direct
  1172. commands. READ(and DATA), GOSUB, and ON GOSUB cannot operate as direct commands, and you cannot use labels in the command line. Apart from these, almost any single or multi-statement line that can be entered in a program can also be entered in the command line.
  1173. Clearly, any statement that refers to another statement in the command line will not operate, because of the absence of labels. However, it is possible to enter GOTO statements which refer to labels in the current program. You may want to do this when you are testing a program. The normal way of executing a program -using the RUN command or Run option - clears the program's variables. GOTO allows you to execute a program or part of a program without destroying any variable assignments that may have already been made.
  1174. You will use the command line for variety of purposes. There are some
  1175. operations - such as appending a text or program file to a file in memory -
  1176. which can only be performed using commands. You may also want to enter commands as an alternative to selecting options from the Superbase menus;but it is generally more practical to do this by assigning the commands to a function key.
  1177. In addition, the command line is valuable tool for developing and testing
  1178. programs. Particularly useful are commands such as:
  1179.     ? MEMORY
  1180. and
  1181.     ? LIST
  1182. The first command lists the current program's variables and their values;the
  1183. second can be used to display the program listing in the database window.
  1184.  
  1185. EDITING THE COMMAND LINE
  1186. The cursor keys move the cursor in the command line one character at a time.
  1187. Home(Clr Home on the Atari ST)and End(Insert on the Atari ST)take the cursor to beginning and end of the command line. Del deletes the character in front of the cursor, Backspace deletes the character before.
  1188. If you make a mistake while typing in the command line, you can use these keys to correct it. Command lines remain in the box after they have been executed and function key commands are placed in the command line box after execution, so you may also want to recall the previous command for editing.
  1189.  
  1190. LOADING A PROGRAM
  1191. To load a program from disk into the Program Editor, select Open from the
  1192. Program menu. A file dialog will appear, listing the names of the program files in the current directory. You can then select a file in the usual way. If you want to load a program in another directory or on another disk, type in the file name preceded by the path name.
  1193. To append a program on disk to program in memory, select the Command option.
  1194. Then enter:
  1195.     LOAD "programname", APPEND
  1196. where "programname" is the name of the program on disk which is to be joined to the current program.
  1197. Most of the programs you run will have been created in the Program Editor.
  1198. However, it also possible to load a program which has been written in a word
  1199. processor, or has been created in another program editor. In this case, there are two requirements:the program file must have an '.sbp' extension, and it must be an ASCII file.
  1200. Note that Open loads a program into the Program Editor, but it does not open the Program Editor window. If the window is closed and you wish to edit a program after loading it, select Edit.
  1201.  
  1202. SAVING A PROGRAM
  1203. Save on the Program menu saves the current program on disk. When you select
  1204. this option. Superbase displays a dialog where you type in the name under which the program is to be saved.
  1205. Normally, programs are saved on disk in 'tokenized' form;instead of storing each character in a keyword, Superbase represents keywords using single character tokens(keywords are represented in this way internally as well as on disk). To save a program as an ASCII file, enter in the command line:
  1206.     SAVE "program name", TEXT
  1207. ASCII program files can be loaded back into the Program Editor and run straight away.
  1208. Note that all program files, both tokenized and ASCII files, are given an '.sbp' extension.
  1209.  
  1210. RUNNING A PROGRAM
  1211. Select Run from the Program menu to run the program in memory. If there isn't a program in the Program Editor, Run displays the program file dialog. When a
  1212. program has been selected, it is loaded into memory and then executed.
  1213. The DML command RUN provides the program equivalent of the menu option. It is
  1214. generally entered as a direct command, but it can also be used within a program.
  1215. As a program command(rather than a direct command), RUN allows you to perform a task by linking together a series of programs. When one stage has been
  1216. completed, RUN followed by a program file name will load and execute the program which performs the next stage.
  1217. However, the drawback to using RUN for this purpose is that loading and
  1218. executing a new program clears the previous program's variables. If you want to link a number of programs together, it usually preferable to use the CHAIN
  1219. command. This provides the same facility as RUN but has the advantage that it
  1220. does not clear any existing variable assignments.
  1221.  
  1222. CREATING A START UP PROGRAM
  1223. One of Superbase's most useful features is the way it lets you specify a 'start up' program, which will be automatically loaded and executed when you run Superbase. There are many ways in which you can take advantage of this feature,  especially if you use Superbase on a regular basis for a specific application.
  1224. All the tasks that you need to perform at the start of a session - such as
  1225. opening files and loading a function key set - can be taken care of by the
  1226. start up program.
  1227. The procedure for creating a start up program is straightforward. There are two requirements:
  1228. The program must be stored in a directory where Superbase will find it:either
  1229. the Start directory as specified in Options on the Set menu(see Chapter 7, 
  1230. Volume 1)or the directory which is current when Superbase is loaded;usually
  1231. this will be the same directory as the Superbase program file.
  1232. The program must be saved under the file name Start(this appears on disk as
  1233. Start.sbp). When you run Superbase, it looks in the current directory for a program with the name Start. If you have specified a Start directory in the '.par' file, it then looks for the program in that directory.
  1234.  
  1235. EXAMPLES
  1236. LOAD KEY "Funkey1"
  1237. OPEN FILE "Address"
  1238. OPEN FILE "Customers"
  1239. SET TABLE
  1240. VIEW
  1241.  
  1242. This program loads a function file, opens two database files, set Table View, and then displays the first record in the Customers file.
  1243.  
  1244. LOAD KEY "Funkey1"
  1245. NUMBASE "z999999."
  1246. RUN "Prog2"
  1247.  
  1248. After loading a function key file, this program sets the numeric format and then loads and executes prog2.
  1249.  
  1250.             CHAPTER 4 - FUNCTION KEYS
  1251.  
  1252. With Superbase's function key facility, you can create a new set of key
  1253. controls. Each function key may be assigned a string of up to 255 characters.
  1254. Depending on the context, Superbase will interpret the string either as a
  1255. command(or sequence of commands)or as text.
  1256.  
  1257. The main applications for this facility are:
  1258.  
  1259. Creating command sequences - one line programs - to provide keyboard
  1260. equivalents for the Control Panel buttons and menu options.
  1261. Creating more complex command sequences which will perform multiple operations with a singl key-stroke. Inserting often-used words, keywords, phrases, and paragraphs in a text document or a program.
  1262.  
  1263. The number of functions keys you can define depends on which version of
  1264. Superbase is used. All versions provide the function keys F1 to F10. In
  1265. addition, Amiga and Atari owners can use the Help key, which may be regarded as key F0. Another set of ten function keys is available when you use F1 to F10 in combination with the Shift key.
  1266. To summarize these differences:
  1267. 21 function keys are available to Amiga and Atari owners;F1 to F10 plus Help, 
  1268. and Shift F1 to Shift F10. MS DOS computers have 40 function keys;F1 to F10, and the same keys in combination with Shift, CTRL or Alt.
  1269.  
  1270. SETTING A FUNCTION KEY
  1271. There are two ways of setting a function key:using the Set Menu option Function keys(Function keys Edit on the Amiga), and using the DML command KEY. With the first method, you select Function keys from the Set menu. You will then be presented with the Function key dialog(see next page).
  1272. On the Amiga, the four keys at the right of the panel are replaced by the HELP and Shift keys. On entry to the dialog, the F1 key is highlighted. Clicking on one of the other keys, F2 to F10 and HELP, highlights the key, making it available for setting. You can then assign a string to the key by typing it in the entry box below. Click in the box first if the cursor is not shown.
  1273. For the Amiga and the Atari, the Shift key is the only one that can be used in combination with the keys F1 to F10 - Shift HELP is the same HELP on its own. When you have set the functions keys you require, click on OK. This action will assign the strings you have entered to their respective keys and then remove the dialog.
  1274. The other method of setting the function keys is to use the DML command KEY -
  1275. either from the Command Line or from a program. Consult the keyword reference
  1276. entry under KEY for an explanation of how to use this command.
  1277.  
  1278. FUNCTION KEYS FOR COMMANDS
  1279. As we mentioned earlier, Superbase treats function key assignments as commands or text according to the circumstances. If one of the editing cursors is active, a function key string is interpreted as text;if a cursor is not present, a string is executed as a command. There are three circumstances in which an editing cursor may be active:when you are editing a document in the Text Editor, or a program in the Program Editor, and when you are editing a field in record edit mode.
  1280. The rules governing the commands which can assigned to function keys are the
  1281. same as for the Command Line(see Chapter 3). If the commands can be executed as a one line program, they can also be assigned to a function key. Note that
  1282. single word commands at the beginning of a function key string must have a
  1283. trailing space if followed by a colon.
  1284.  
  1285. EXAMPLES
  1286. The following function key strings show how you can create keyboard equivalents for the Control panel buttons:
  1287.  
  1288. SELECT FIRST:VIEW
  1289.  
  1290. This has the same effect as clicking on the First record button.
  1291.  
  1292. SELECT LAST:VIEW
  1293.  
  1294. Equivalent to the Last Record button.
  1295.  
  1296. a%=0:a$=" ":REQUEST "Locate key", "", 4, a%, a$, 20:
  1297. IF a$ <> " " THEN SELECT KEY a$:VIEW
  1298. Equivalent to the Key Lookup button. The REQUEST command is not necessary for
  1299. this purpose, but it allows you to display a customized dialog, making the
  1300. operation of using an index key easier to perform.
  1301. It is worth pointing out that the command KEY lists all the current function
  1302. key assignments to the current output device. You may find it useful to assign this command to one of the function keys. Enter the single KEY as the function key string. Pressing the key will then show you at glance what the settings are for the other keys.
  1303.  
  1304. FUNCTIONS KEYS FOR TEXT AND PROGRAM ENTRY
  1305. In text entry, Function keys are useful for entering text strings which occur
  1306. many times in the same document or are regularly used in different documents.
  1307. They save you the trouble of having to type in the string yourself everytime it is needed. Provided the text cursor is shown on screen, pressing a function key will insert a string at the point where the cursor is located.
  1308. The same applies to the use of function keys in program entry. You can define
  1309. function keys to insert commonly used keywords in a program. For example, you
  1310. might want to define the keys F1 to F5 as:
  1311. REM
  1312. LOAD "
  1313. SAVE "
  1314. OPEN FILE "
  1315. WHILE
  1316.  
  1317. Keys F5 to F10 could then be assigned commands which are useful during program development (you would have to activate the database window before these could be executed):
  1318. MEMORY
  1319. RUN
  1320. PAGING ON:? LIST
  1321. EDIT
  1322. STATUS
  1323.  
  1324. If you wish to assign a text string that runs over several lines, you need to
  1325. use the carriage return character. However, it is not possible to enter this
  1326. character in the Function keys dialog, so you must enter it using the KEY
  1327. command in a program or in the Command Line. Thus to assign an address to F1, 
  1328. you enter a string like this:
  1329.  
  1330. KEY 1, "6 Park Terrace " + CHR$(13) + "Worcester Park" +
  1331. CHR$(13) + "Surrey KT4 7 JZ" + CHR$(13)
  1332.  
  1333. NOTE:In most cases, function key strings which are intended for text entry
  1334. cannot be executed as commands. Pressing a function key of this type when the
  1335. cursor is not active may cause an error message.
  1336.  
  1337. EDITING A FUNCTION KEY STRING
  1338. If a function key has already been set, selecting the Function keys option
  1339. (Function keys Edit on the Amiga)from the Set menu displays the contents of the key in the string entry box. Initially, the setting for the F1 key will be shown. If you wish to change the current setting, you can do so using the same editing controls as for the Command Line:cursor keys, Backspace, Del, Home and End. Alternatively, click on Clear to remove the current setting and type in a new function key string. Remember to press the Return key after editing a function key; otherwise your alterations will not be registered.
  1340.  
  1341. FUNCTION KEY FILES
  1342. The strings you assign to the functions keys can be saved on disk for use in
  1343. other sessions with Superbase. Function key files are saved as ASCII files with the extension '.sbk'. If you wish to examine a function key file, you may display it on screen or print it out with the List option on the System menu. Notice that any keys which have not been assigned a string are shown as blank lines.
  1344.  
  1345. SAVING FUNCTION KEY FILES
  1346. Selecting the Function keys Save option saves the current function key settings on disk. Superbase adds the '.sbk' extension to the file name you type in. Function keys Save presents you with a file dialog, showing the existing '.sbk' files in the current directory. This operates in the same way as any other file dialog. If you select a file name from the list - instead of typing in a new name - a dialog will appear, asking if you wish to overwrite the selected file. You can then click on OK to overwrite, or Cancel to halt the operation.
  1347.  
  1348. LOADING FUNCTION KEY FILES
  1349. Select Function keys Load from the Set menu to load a function key file from
  1350. disk. A file dialog will appear showing the '.sbk' files in the current
  1351. directory. After a file has been selected, it is loaded into memory and sets the current function keys.
  1352. The LOAD KEY "file name" command is used to load a function key file under
  1353. program control or from the Command Line. Once you have created the function
  1354. key set that meets your requirements, you can include this command, followed by the name of the function key file, in the Start program(see Creating a Start up program, Chapter 3). This way, the function keys will be set up for you as soon as Superbase has loaded.
  1355. Another way of using the LOAD KEY command is to assign it to a function key.
  1356. You will then be able to load a specified function key file with a single key
  1357. press.
  1358.  
  1359.             CHAPTER 5 - KEYWORD REFERENCE GUIDE
  1360.  
  1361. SYNTAX CONVENTIONS
  1362. This section describes the conventions that have been used in the following
  1363. documentation.
  1364. The general format used to explain each keyword is as follows:
  1365. PURPOSE -a brief description of the keyword.
  1366. SYNTAX - the format of the keyword.
  1367. COMMENTS - explains the format and function of the keyword in more detail.
  1368. EXAMPLES - program examples.
  1369. NOTES - explains the program examples and covers any other points not dealt
  1370. with under the above headings.
  1371. For the syntax of the keyword, the following terms and symbols are used:
  1372.  
  1373. nexpr
  1374. This can be any valid numeric expression consisting of numeric fields, date
  1375. fields, numeric constants and/or numeric results of other keywords. For
  1376. example, if a function expects a numeric argument, you could enter any of the
  1377. following expressions:
  1378.     156        (an integer)
  1379.     156.25    (a floating point number)
  1380.     num%        (a numeric variable)
  1381.     numfield    (the name of a numeric field in a file)
  1382.     3 + 6    (the result of an expression)
  1383.     SQR(25)    (the result of a keyword)
  1384.  
  1385. strexpr
  1386. This can be any string or substring from a text field, external field, string
  1387. variable, text literal or string result of other keywords. For example, any of the following expressions would be suitable entries for strexpr:
  1388.     "hello"        (a string constant)
  1389.     strfield    (the name of a string field)
  1390.     numfield    (the name of a numeric field)
  1391.     fielda$        (a string variable)
  1392.     fielda$        (a string variable)
  1393.     Address        (a file name)
  1394.     MID$("immediately", 3, 2)  (a calculated result)
  1395.  
  1396. var
  1397. This can be any variable, string or numeric. If the keyword requires variables of a particular type, strvar or nvar are used for string or numeric variables.
  1398. Various other conventions - such as fieldname or just field - are used to
  1399. indicate particular data types. These should be self-explanatory.sbfile, for
  1400. example, means that you should enter the name of a database file;on disk, 
  1401. Superbase identifies database files by an .sbf extension, but you should not
  1402. include the extension name when you use it in a DML command.
  1403. Any parameters or arguments contained in parentheses are compulsory(including
  1404. any commas), while those within square brackets- '['and']' - are optional. All other arguments are compulsory. For instance, supposing the syntax for a keyword is given as:
  1405.     XXX(strexpr$, nexpr[.nexpr2])
  1406. This means that strexpr and nexpr are required with the keyword XXX and that
  1407. they must be separated by a comma. The next argument, nexpr2, is optional, but if used must be separated from the second argument by a comma.
  1408. The '/' character is used to indicate a number of alternatives. For example:
  1409.     CLOSE ALL/FILE sbfile
  1410. The syntax for this statement indicates that CLOSE can be followed by either
  1411. ALL or FILE, but not both at the same time.
  1412.  
  1413. ? COMMANDS
  1414. ? is a general purpose output command. You can use it to display information on screen, or to send information to the printer, or to create a file on disk.
  1415. When ? is followed by a list of expressions - text, numbers, variables, fields, etc it sends the expressions to the current output device. It can also be used with the following keywords:
  1416.     DIRECTORY
  1417.     LIST
  1418.     MEMORY
  1419.     QUERY
  1420.     STATUS
  1421.     TEXT
  1422. These keywords have a specific function when used with ?, and have been treated as separate commands. You will find an entry for each of them further on in this section.
  1423.  
  1424. CHANGING THE OUTPUT DEVICE
  1425. When you load Superbase, the ? command takes the screen as the default device
  1426. and works in the same way as the PRINT command does in other versions of Basic - it displays information on screen. If you want to direct output to another device use one of these commands first:
  1427.     PARAMETER        PURPOSE
  1428.     PRINT            for the printer
  1429.     OUTPUT TO        for the disk drive
  1430.     DISPLAY            to switch back to the screen
  1431. ? then continues to output to the device selected by one of these commands. CLS and HOME do not reset the current output device.
  1432. PRINT and DISPLAY can be followed by a list of expressions which will then be
  1433. output to the devices associated with these commands. When you use PRINT and
  1434. DISPLAY simply to change the current output device, they should be followed by a semicolon, as in:
  1435.     PRINT;
  1436. which directs all future output to the printer.
  1437. OUTPUT TO needs a filename after it, as in:
  1438.     OUTPUT TO "texta"
  1439. which directs output to a file on disk named 'texta'.
  1440.  
  1441. OUTPUT FORMAT PARAMETERS
  1442. After outputting a list of expressions, the ? command starts a new line unless you specify otherwise. This means that it takes the cursor to the beginning of the next line(if the current output device is the screen). You can instruct DML to output the next list of expressions on the same line, by placing a semicolon at the end of an expression list. When it is used in this way, the semicolon is known as an output format parameter, and is one of a number of parameters that allow you to specify how output is formatted.
  1443. Apart from the semicolon, you place these parameters in front of the expressions that you want to format. Thus you can place them at the front of the line immediately after the ? character, and you can also insert them in the middle of an expression list.
  1444. Some output parameters are keywords such as BF and DOWN, and others are symbols such as the semicolon itself and the @ sign. If you use keyword parameters, they must separated from each other by spaces. For example, DML will accept a line like this:
  1445.     ? UL BF IT "One", , "TWO' UL OFF @5, 10"Three"
  1446. but it will not accept
  1447.     ? ULBFIT"One", , "Two"ULOFF@5, 10"Three"
  1448. The output format parameters for the ? command are:
  1449. PARAMETER            PURPOSE
  1450. &                Sets length of text string
  1451. @                Sets row and column position
  1452. ,                 Outputs a space
  1453. ;                Used as a separator and to suppress new line
  1454. DOWN                Outputs each item on a new line
  1455. ALL                Outputs all the fields in the current record
  1456. NEWLINE            Starts a new line
  1457. BF[ON]            Sets text to bold face
  1458. UL[ON]            Underlines text
  1459. IT[ON]            Sets text to italic
  1460. BF/UL/IT OFF        Turns selected text attribute off
  1461. ATTR OFF            Turns all text attributes off
  1462. FG(Amiga only)        Sets foreground color
  1463. BF(Amiga only)        Sets background color
  1464. SAY(Amiga only)        Speaks output
  1465. EJECTnn            Outputs data on a new page if there are less than nn
  1466.                 lines left at the bottom of the page
  1467.  
  1468. COMMENTS
  1469. The @ sign, followed by a numeric expression, specifies the coloumn and row
  1470. position for your output. For example, if the screen is the output device
  1471. selected:
  1472.     ? @12, 7"Smith"
  1473. displays the name Smith on the screen at column 12, row 7. As an alternative to using @, see LOCATE.
  1474. DML treats a comma as a space character. For example:
  1475.     ? "Hello", , , "goodbye"
  1476. outputs
  1477.     Hello   goodbye
  1478. Placing a semicolon after the last expression in the output list prevents DML
  1479. from outputting a new line character. For example:
  1480.     ? "Hello":? "there"
  1481. outputs them on the same line as
  1482.     Hello there
  1483. Note that when the output device is the screen, DML only outputs the expressions in a list when it starts a new line. For example, if you enter the line:
  1484.     ? "one";"two";"three";
  1485. nothing will appear on the screen until you enter another line which does not
  1486. have a semicolon at the end of it.
  1487. If used, DOWN must be placed at the front of a line, before the line's
  1488. expressions and after the ? character. It ensures that each expression in the
  1489. list is output on a new line. For example:
  1490.     ? DOWN "one";"two";"three"
  1491. nothing will appear on the screen until you enter another line which does not
  1492. have a semicolon at the end of it.
  1493. If used, DOWN must be placed at the front of a line, before the line's
  1494. expressions and after the ? character. It ensures that each expression in the
  1495. list is output on a new line. For example:
  1496.     ? DOWN "one";"two";"three"
  1497. formats the output on screen as
  1498.     one
  1499.     two
  1500.     three
  1501. When Down is used to format field data, it displays the field names in inverse video at the left of the data - in same way as Record View displays a record.
  1502. ALL outputs the fields in the current record; for example, if the screen is the current output device:
  1503.     ? DOWN ALL
  1504. would have the same effect as clicking on the current record button when Record View is selected.
  1505. NEWLINE instructs DML to start a new line. Thus
  1506.     ? "one", "two"NEWLINE "three"
  1507. outputs the expressions as
  1508.     one two
  1509.     three
  1510. NEWLINE can also be used on its own - see NEWLINE, Keyword Reference.
  1511. BF, UL, and IT set the text style for output.
  1512. BF    sets boldface
  1513. UL    sets underline
  1514. IT     sets italic
  1515. Each of these can be set by ON(which is optional)and cleared by OFF.
  1516. ATTR OFF clears all the text style attributes.
  1517. For example:
  1518.     ? BF"Bold face on";IT "italics on";BF OFF IT OFF "Bold and italics off"
  1519. On the Amiga you can also set the forground and background colours, using FG and BG. Each takes a parameter in the range 1 to 4 for the four colours set by Preferences. For example:
  1520.     ? FG 2 BF 1 "Foreground colour 2, background colour 1"
  1521. SAY, which is only availabe on the Amiga, uses the Amiga's narrator device to
  1522. speak the items in an expression list. Thus if you wanted to speak the field
  1523. names and field data for the current record, you would enter:
  1524.     ? SAY DOWN ALL
  1525. EJECT can be used to ensure that a group of data items - the fields in a
  1526. record, for example - all appear on the same page. For example:
  1527.  
  1528.                 5-6
  1529.  
  1530.     ? DOWN "One";"Two";"Three";"Four" EJECT 4
  1531. displays a new page if there is not enough room at the bottom for the four
  1532. items in the expression list.
  1533.  
  1534. ?
  1535. PURPOSE
  1536. Sends information to a device.
  1537.  
  1538. SYNTAX
  1539. ? [@nexpr] [;expr;expr, ....]
  1540.  
  1541. COMMENTS
  1542. Used to send one or more expressions(an expression list)to the current output
  1543. device. ? can also include any of the output format parameters.
  1544. When you output nemeric, date, and time constants or the results of functions for these data types, they take the format which has been set with the Number or Date/Time format options on the Set menu(or with the commands NUMBASE and
  1545. DATEBASE). Field data is output in the format set in the file definition.
  1546. However, you can force Superbase to output field data in the current format by enclosing the field name in brackets. Thus:
  1547.     ? (numfielda), (datefielda)
  1548. displays the contents of these fields in the current numeric and date formats
  1549. rather than in the formats they have been given in the file definition.
  1550.  
  1551. EXAMPLES
  1552. 1    ? "Hello"
  1553. 2    ? "Hello";a$
  1554. 3    ? UL BF "Hello";a$;NEWLINE b$
  1555. 4    ? "The square root of";n%;"is";SQR(n%
  1556. 5    ? "One""two""three"
  1557.  
  1558. NOTES
  1559. Depending on the numeric format that has been set, example 4 would output the
  1560. numeric expressions, n% and SQR(n%), with leading spaces. To remove these, you would have to use the STR$ and LTRIM$ functions.
  1561. You will notice that there are no semicolons separating the expressions in
  1562. example 5. It is not always to place a semicolon between two expressions.
  1563. Provided DML has some other way of telling where one expression ends and the
  1564. other one starts, you can omit the semicolon. In this example the quotation
  1565. marks allow DML to distingusih between the three expressions.
  1566.  
  1567. ? DIRECTORY
  1568.  
  1569. PURPOSE
  1570. Lists the current directory to an output device.
  1571.  
  1572. SYNTAX
  1573. [?] DIRECTORY
  1574.  
  1575. COMMENTS
  1576. When the screen has been selected as the current output device, the directory is listed in two columns in alphabetic order. If the output device is the printer or a disk file, the directory is listed in single column.
  1577. The "?" command is optional - DIRECTORY on its own has the same effect.
  1578.  
  1579. ? LIST
  1580. PURPOSE
  1581. List a program in memory to an output device.
  1582.  
  1583. SYNTAX
  1584. ? LIST
  1585.  
  1586. COMMENTS
  1587. Do not confuse this command with LIST, which displays a text file on screen. ? LIST has several applications. You can use it to examine a program listing by displaying it on screen on printing it out;and, when the current output device is the disk drive, it allows you to save a program as a text file. In this last application, it has the same effect as:
  1588.     SAVE "program name", TEXT
  1589.  
  1590. ? MEMORY
  1591. PURPOSE
  1592. Sends information about any defined variables to an output device.
  1593.  
  1594. SYNTAX
  1595. [?] MEMORY
  1596.  
  1597. COMMENTS
  1598. This outputs the variables in memory as:
  1599.     a%=123.46
  1600.     b%=12.00
  1601.     a1$="aaaaaaaaaaaaaa bbbbbbbb"
  1602.     etc.
  1603. The variables are output in the order in which they were assigned. If you
  1604. specify OUTPUT TO file, the values of the variables can be recovered for a
  1605. subsequent program by the SET file command.
  1606. The "?" command is optional - MEMORY on its own has the same effect.
  1607.  
  1608. ? QUERY
  1609. PURPOSE
  1610. Runs the current Query in memory and sends the results to an output device.
  1611.  
  1612. SYNTAX
  1613. ? QUERY
  1614.  
  1615. COMMENTS
  1616. Query has four output options(on the Amiga, SAY provides a fifth option). You
  1617. can send the output from a Query to the screen, the printer, to disk(as an ASCII file) or to file(as an '.sbf' file). However, when you save a Query, the currently selected output option is not saved with the rest of the Query settings; so if you run a Query under program control, you will need to select the output device beforehand.
  1618. To send output to the printer, either set the Printer option from the Set menu, or issue a PRINT;command. To send output to disk, you should use the OUTPUT TO filename or OPEN filename FOR OUTPUT commands.
  1619. The Query output will then be stored on disk under file name specified.
  1620.  
  1621. EXAMPLES
  1622. 1    LOAD QUERY "Stockrep"
  1623.     PRINT;
  1624.     ? QUERY
  1625. 2    LOAD QUERY "Addreport"
  1626.     OPEN "Addrep.asc" FOR OUTPUT
  1627.     ? QUERY
  1628.  
  1629. NOTES
  1630. In the first example, output from the Stockrep Query is directed to the printer; in the second example, output from the Addreport query is used to create an ASCII file on disk under the name Addrep.asc.
  1631.  
  1632. ? STATUS
  1633. PURPOSE
  1634. Sends information about the System Status
  1635.  
  1636. SYNTAX
  1637. [?]STATUS[FILE sbfname]
  1638.  
  1639. COMMENTS
  1640. ? STATUS without the FILE option gives the same output as the menu option
  1641. System Status. If no Superbase files('.sbf' files)are open, it displays the
  1642. following information:
  1643.     Memory free
  1644.     Diskspace Free
  1645.     Current Directory Name
  1646.     Superbase Files open(as 0)
  1647.     Superbase Files available.
  1648. If any database files are open, the header information for these files is also shown.
  1649.     ? STATUS FILE sbfname
  1650. gives the same output as the menu option SYSTEM STATUS FILE, and
  1651. produces a status report for the file. At the top of the report, it shows file statistics such as the nmber of records and the file siz. Belows this, it shows the file definition details:for each field, it lists the field name, its attributes, format, Form View location, and any associated calculation or
  1652. validation formula.
  1653. If the file is not open, the error message 'Can't do this / File not open'
  1654. appears.
  1655. The '?' command is optional with STATUS - using STATUS on its own has the same effect.
  1656.  
  1657. ? TEXT
  1658. PURPOSE
  1659. Sends a text file in memory to an output device.
  1660.  
  1661. SYNTAX
  1662. ? TEXT[MERGE]
  1663.  
  1664. COMMENTS
  1665. This command outputs the current text file in the Text Editor. If the text file is a form letter and its associated database file has been opened, adding the MERGE command will merge the data in the current record with the text file. See also the Keyword Reference entry for MERGE.
  1666.  
  1667. EXAMPLES
  1668. 1     OPEN FILE "Address"
  1669.       LOAD TEXT "Maillet"
  1670.     ? TEXT MERGE
  1671.  
  1672. NOTES
  1673. If the current output device is the screen, this example will insert the data
  1674. from the first record(in the Address file)into the Maillet text file, and
  1675. display the result in the database window.
  1676.  
  1677. ABS
  1678. PURPOSE
  1679. Turns negative numbers into positive numbers but leaves positive numbers
  1680. unchanged.
  1681.  
  1682. SYNTAX
  1683. ABS(nexpr)
  1684.  
  1685. COMMENTS
  1686. ABS returns the 'absolute' value of a number. In effect, it simply strips the
  1687. sign off a negative number, making it positive. One of its common uses is for
  1688. calculating the difference between two numbers when you do not know which is
  1689. larger. In example 2, which works out the number of days between two dates, ABS allows you to enter the dates without first knowing which is the later date.
  1690.  
  1691. EXAMPLES
  1692. 1    numfieldc=ABS(numfielda)
  1693. 2    numfieldc=ABS(datefielda-datefieldb)
  1694. 3    numfieldc>ABS(numfielda * numfieldb)
  1695. 4    x%=ABS(y%)
  1696. 5    x%=ABS(y% * numfielda * (datefielda-datefieldb))
  1697. 6    x%=ABS(VAL(RIGHT$(textfielda, 5)))
  1698. 7    ? ABS(x%)
  1699.  
  1700. ADD
  1701. PURPOSE
  1702. Adds a new field to a file definition.
  1703.  
  1704. SYNTAX
  1705. ADD[FILE sbfname]field-definition-string[formula-string][formula-string]
  1706.  
  1707. COMMENTS
  1708. This command is used in conjunction with CREATE and MAKE to create a new
  1709. Superbase database file. It cannot be used to add a field to an existing file.
  1710. To use ADD correctly, you need to understand how a file definition is set up.
  1711. The best way to do this is to use the STATUS FILE option in Superbase's System menu. This will show you the file definition for the current file. Another way of viewing the same information would be to list an '.sbd' file on screen using the System menu's LIST option.
  1712. With one exception, the parameters used with ADD to define a field are the same as those used in '.sbd' file definitions. The exception is '>' and '>>'. These are used in '.sbd' files to indicate that there are one or two formula lines to follow. You do not need to include these characters in a field definition string.
  1713. From left to right, the field definition string is composed of the following
  1714. parameters:
  1715. fieldname
  1716. fieldtype[other fieldtype parameters]
  1717. format[case and multiple response parameter for text fields]
  1718. row; col
  1719. Each of these parameters must take the same form as it does in an 'sbd' file.
  1720. fieldname must conform to the rules for fieldnames.
  1721. fieldtype must be one of the following:
  1722. TXT    text
  1723. EXT    external
  1724. NUM    numeric
  1725. DAT    date
  1726. TIM    timefield
  1727. DEL    deleted
  1728.  
  1729. The other fieldtype parameters are optional and, if used, are separated from
  1730. fieldtype and each other by at least one space. You can specify up to three of these parameters, selecting one from each of the following groups:
  1731.  
  1732. A)
  1733. CLC    Calculated
  1734. CLV    Calculated and validated
  1735. CON    Constant
  1736. COV    Constant and validated
  1737. VAL    Validated
  1738.  
  1739. B)
  1740. RDO    Read only
  1741. RDQ    Read only required
  1742. REQ    Required
  1743.  
  1744. C)
  1745. IXU    Indexed - Unique
  1746. IXD    Indexed - Normal
  1747.  
  1748. format specifies the length of a field and the numeric format for numeric
  1749. fields, format must be appropriate for the field type. For example, 20 for TXT, z99999.00 for NUM, ddmmmyy for DAT.
  1750. The case parameter can be U, L or C, depending on whether the text data is to
  1751. shown in upper case, lower case or with the first letter capitalized. The
  1752. multiple response parameter is M followed by the number of elements in the
  1753. multiple response field(maximum 9). These parameter are optional and can only
  1754. be used with text fields. They must be separated from the field format by at
  1755. least one space. For example, to define a text field with three multiple
  1756. response fields, each up to 15 characters long, you would enter these parameters:
  1757.     15 M3;
  1758. If you also wanted the field data to be in upper case, you would enter:
  1759.     15 UM3;
  1760. row is the row position for FORM-view(maximum 255).
  1761. col is the column position for FORM-view(maximum 255).
  1762. row and col are optional, but you are strongly recommended to use them. If they are not used, all the fields will be positioned at the top left of the screen on top of one another when the record is displayed in Form View.
  1763. The field types in group A-CLC, CLV, CON, COV, VAL-must be followed by a formula or formulas. CLV and COV require two formulas;the formula for constants or calculations should be come first, followed by the validation formula. Formulas should be enclosed in quotation marks and must be separated by commas from the first part of the field definition string and from each other.
  1764. formula-string must follow the rules(given in Volume 1)for using formulas for
  1765. calculations, constants and validations.
  1766. Since formulas must be enclosed in quotation marks, DML will be confused if a
  1767. formula itself contains quotation marks, as in:
  1768.     fielda LIKE "[a-c]*"
  1769. The simplest solution here is to use the tilde character '~' in place of
  1770. quotation marks. When you execute the ADD command, DML will interpret the tilde as a quotation mark.
  1771. An alternative solution is to use the CHR$ function to insert quotation marks
  1772. the ASCII code for quotation marks is 34. Thus the line to set up a validated
  1773. field called fielda of length 12 at row 5, column 20 would be:
  1774.     ADD"fielda;TXT VAL;12, 5;20", "fielda LIKE" + CHR$(34)
  1775.     + "[a-c]*" + CHR$(34)
  1776. In the unlikely event that your formula actually requires a tilde character, 
  1777. you can insert it in a string variable using CHR$(126).
  1778. Note that the maximum length for a program line is 255 characters. Since a
  1779. formula can also be up to 255 characters long, you may be unable to enter the
  1780. entire field definition on a line. The solution is to assign formulas to string variables beforehand. For example:
  1781.     a$="Price.Orders * Quantity.Orders"
  1782.     ADD "Subtotal;NUM;$9999999.00;5, 20", a$
  1783.  
  1784. EXAMPLES
  1785. 1 ADD "aatext;TXT REQ IXU;20 M3;1, 12"
  1786. 2 ADD "aanumb;NUM;z999999.00;1, 40"
  1787. 3 ADD "bbtext;TXT CLC RD0;10;2, 12", "UCASE$(LEFT$(aatext, 10))"
  1788. 4 ADD "fielda;TXT VAL;12;15;20", "fielda LIKE " + CHR$(34) + "[a-c]*"
  1789.   + CHR$(34)
  1790.  
  1791. NOTES
  1792. Creating a file under program control is a three stage process involving
  1793. CREATE, ADD, and MAKE. For a description of the process, see CREATE.
  1794.  
  1795. AFTER GROUP
  1796. PURPOSE
  1797. Set after group activity with reports.
  1798.  
  1799. SYNTAX
  1800. AFTER GROUP fieldname
  1801.  
  1802. COMMENTS
  1803. When you create a report using the Forms Editor's reporting facility, Superbase generates a Report program for you. The AFTER GROUP statement is used within a Report program to mark the start of an AFTER GROUP section. This consists of a series of "?" statements which specify the information that is output every time a group changes. Each statement corresponds to a line in the AFTER GROUP box in the Forms Editor.
  1804. fieldname identifies the group and must be name of a field which has previously been defined as a group with the GROUP statement. An AFTER GROUP section must end with an END REPORT statement.
  1805.  
  1806. EXAMPLES
  1807. 1     AFTER GROUP Lastname.Clients
  1808.     ? BF ?Client", GROUP, "has";COUNT amount;"Deposits"
  1809.     ? BF "Total desposits are", @25SUM amount
  1810.     ? BF "Maximum is", @s5 MAX amount
  1811.     ? BF "Minimum is", @25 MIN amount
  1812.     END REPORT
  1813.  
  1814. NOTES
  1815. In the second line of this example, the keyword GROUP is used in order to
  1816. retrieve the name of the last group. At this point, the group has already
  1817. changed;so, Lastname.Clients could not be used instead of GROUP because it would output the name of the current group.
  1818.  
  1819. EXAMPLES
  1820. 1    AFTER REPORT
  1821.     ?@1, 3;UL "Statistics for the Report", UL OFF:?
  1822.     ?"Total amount is", @30 SUM amount
  1823.     ?"Number of deposits", @30 COUNT amount
  1824.     ?"Average amount", @30 MEAN amount
  1825.     END REPORT
  1826.  
  1827. ASC
  1828. PURPOSE
  1829. Returns the ASCII value of a single character.
  1830.  
  1831. SYNTAX
  1832. ASC(strexpr)
  1833.  
  1834. COMMENTS
  1835. ASC gives a numeric value-the ASCII code-for the text character in strexpr. When strexpr is longer than one character ASC returns the ASCII code of the leftmost character of strexpr. Appendix E, Volume 1, gives the ASCII characters and their decimal codes.
  1836. The complementary function of ASC is CHR$.
  1837.  
  1838. EXAMPLES
  1839. 1    numfieldc=ASC(textfielda)
  1840. 2    numfieldc=ASC(RIGHT$(textfielda, 1))
  1841. 3    ASC(textfielda) > 64 AND ASC(textfielda) < 91
  1842. 4    x%=ASC("A")
  1843. 5    x%=ASC(x$)
  1844. 6    x%=ASC(UCASE$(MID$(extfield, 3, 1)))
  1845. 7    ?ASC(x$)
  1846.  
  1847. NOTES
  1848. Example 3 provides one way of validating a text field to ensure that the first character is uppercase(but see FCASE$).
  1849.  
  1850. ASK
  1851. PURPOSE
  1852. Inputs a character string from the keyboard.
  1853.  
  1854. SYNTAX
  1855. ASK[pos] [string] [&length];var/field
  1856.  
  1857. COMMENTS
  1858. This command allows the user to enter information from the keyboard into the
  1859. computer while a program is running. It expects the user to type in one or more characters, and, as soon as the Return key is pressed, reads them into a variable or a field.
  1860. string can be used to include a prompt message.
  1861. pos gives the position of the prompt text and input string. It uses the @
  1862. output format parameter to specify the column position, followed by the row
  1863. position. If pos is not given then the input string appears on the row where
  1864. the cursor is currently located.
  1865. &length limits the length of the input and shows the maximum length on screen
  1866. using an 'end-of-field' marker.
  1867. The input can be assigned to a variable or a field(in a currently open file).
  1868. If the field is not in the current file, it can be specified with the filename extension.
  1869. var or field can be either string or numeric variables or fields, and they must match the type of input expected:a string variable will accept whatever you type in, but a numeric variables when you input non-numeric data such as
  1870. letters. The same restriction applies to numeric fields.
  1871.  
  1872. EXAMPLES
  1873. 1    ASK;x$
  1874. 2    ASK@2, 12"Enter a text string";x$
  1875. 3    ASK@2, 14"Enter a 3 character word"&3;x$
  1876. 4    ASK"Enter data-Customer Code"&8Cuscode.custfile
  1877. 5    ASK"Enter a number";n%
  1878.  
  1879. ATN
  1880. PURPOSE
  1881. Calculates an angle whose tangent is known. The result is given in radians.
  1882.  
  1883. SYNTAX
  1884. ATN(nexpr)
  1885.  
  1886. COMMENTS
  1887. This function works out the angle from the angle's tangent given in nexpr. For example: TAN(0.7854)is 1.0, so ATN(1.00)returns 0.7854 rads(which is 45 degrees). To convert radians to degrees multiply by PI/180.
  1888.  
  1889. ATN is the complementary function of TAN.
  1890.  
  1891. EXAMPLES 
  1892. 1    numfieldc=ATN(numfielda)
  1893. 2    x%=ATN(y%)
  1894. 3    x%=ATN(VAL(x$))
  1895. 4    ?ATN(x%)
  1896.  
  1897. BEFORE GROUP
  1898. PURPOSE
  1899. Set before group activity with reports.
  1900.  
  1901. SYNTAX
  1902. BEFORE GROUP fieldname
  1903.  
  1904. COMMENTS
  1905. BEFORE GROUP is used in a Report Program to mark the start of a BEFORE GROUP
  1906. section.fieldname identifies the group, and must be the name of a field which
  1907. has previously been defined as a group-in the Forms Editor, you define a group in the SELECT box; Superbase then translates this into a GROUP statement in a Report program.
  1908. The statements in the BEFORE GROUP section ar executed every time the group
  1909. changes. Typically, they would be used to display header information for the
  1910. group data which follows.
  1911. A BEFORE GROUP section must end with an END GROUP statement.
  1912.  
  1913. EXAMPLES
  1914. 1    BEFORE GROUP Lastname.Clients
  1915.     ? "Deposits for client", Lastname.Clients
  1916.     ?
  1917.     ?"Firstname Lastname Bank Amount Date"
  1918.     "--------------------------------------"
  1919.     END GROUP
  1920.  
  1921. BELL
  1922. PURPOSE
  1923. Makes a short beep.
  1924.  
  1925. SYNTAX
  1926. BELL
  1927.  
  1928. COMMENTS
  1929. Use this command to signal that a particular process has finished and to
  1930. attract the user's attention.
  1931. On the Amiga, BELL does not make a sound but causes the screen to flash.
  1932.  
  1933. BLANK
  1934. PURPOSE
  1935. Creates a blank record in memory.
  1936.  
  1937. SYNTAX
  1938. BLANK[FILE sbfname]
  1939.  
  1940. COMMENTS
  1941. When you want to create a new record under program control, issuing a BLANK
  1942. statement is the first step in the process. It sets up an empty record record
  1943. ready for data entry. There are several ways in which you can then enter data
  1944. into the record's fields.
  1945. Using BLANK with ENTER, allows the user to type in the data for a new record
  1946. from the keyboard. Together these two commands have the same effect as the
  1947. RECORD NEW option in the RECORD menu.
  1948. Alternatively, you can enter data from within a program, by assigning it directly to the fields in the new record. Typically, this would be the method you used to create new records by reading data in from another file on disk.
  1949.  
  1950. EXAMPLES
  1951. 1    BLANK
  1952. 2    BLANK FILE"abc"
  1953. 3    BLANK
  1954.     ENTER
  1955.     STORE
  1956. 4    BLANK
  1957.     Firstname.address="John"
  1958.     Lastname.address="Smith"
  1959.     STORE
  1960. The first example creates a new record in the current file. Example 2 creates a new record in another open file. Example 3 creates a new record in the current file, and allows the user to enter in the record;then it saves the record on disk. Example 4 creates a new record, and enters data into the fields Firstname and Lastname;then saves the record on disk.
  1961.  
  1962. BREAK
  1963. PURPOSE
  1964. Allows the user to interrupt or halt a program from the keyboard.
  1965.  
  1966. SYNTAX
  1967. BREAK ON/OFF
  1968.  
  1969. COMMENTS
  1970. BREAK ON and BREAK OFF enable and disable CTRL C. After BREAK ON(the default
  1971. condition), you can stop a program while it is running by pressing the Control key and C at the same time. This has the same effect as clicking on the STOP button at the bottom of the screen. CTRL C generates error 11. If you want to include error handling routines in your programs, you can use the ON ERROR statement to check for this error number.
  1972.  
  1973. CALL
  1974. PURPOSE
  1975. Calls a user supplied function.
  1976.  
  1977. SYNTAX
  1978. CALL function
  1979.  
  1980. COMMENTS
  1981. function is string expression containing a command line to be executed by DOS
  1982. or Amiga DOS. The expression should duplicate a command line that would
  1983. normally be typed at the DOS or CLI prompt. Superbase stays in memory so there must be enough memory for the specified command to function correctly.
  1984.  
  1985. CHAIN
  1986. PURPOSE
  1987. Executes another program from within a program but does not clear the first
  1988. program's variables.
  1989.  
  1990. SYNTAX
  1991. CHAIN filename
  1992.  
  1993. COMMENTS
  1994. CHAIN allows you to carry out a task by linking together a number of programs.
  1995. When a program is running, this command loads another program from disk, and
  1996. transfers control to it. The second program displaces the first in memory but
  1997. any variables that have already been set retain their values.
  1998.  
  1999. EXAMPLES
  2000. 1    CHAIN "Nextprog"
  2001.  
  2002. CHR$
  2003. PURPOSE
  2004. Generates the character associated with an ASCII code.
  2005.  
  2006. SYNTAX
  2007. CHR$(nexpr)
  2008.  
  2009. COMMENTS
  2010. CHR$ works in the opposite way to ASC. Wheras ASC takes a character and returns its ASCII code, CHR$ generates the character from its associated code. It is useful for handling characters which are not available from the keyboard, such as certain characters used to control a printer.
  2011. nexpr must have a positive value in the range 0-255(although not all these
  2012. values will give printable characters). A value outside this range will give
  2013. the error 'Invalid numeric parameter'. If nexpr is not an integer, the integer part of the number is used, i.e., 65.999 is treated as 65.
  2014.  
  2015. EXAMPLES
  2016. 1    textfieldc=CHR$(numfielda)
  2017. 2    textfieldc=CHR$(INT(numfielda/256))
  2018. 3    x$=CHR$(65)
  2019. 4    x$=CHR$(ASC(y$)+32)
  2020. 5    FOR n%=32 to 127
  2021.     ? CHR$(n%);
  2022.     Next
  2023.  
  2024. NOTES
  2025. Example 3 stores the letter A in x$. Example 4 demonstrates one way of turning an uppercase character into lowercase - but see LCASE$ and FCASE$. Example 5 displays the character set on the screen. Note that it does not display characters are non-printing characters, and some of them have unexpected effects when you attempt to display or print them.
  2026.  
  2027. CLEAR
  2028. PURPOSE
  2029. Clears all user variables.
  2030.  
  2031. SYNTAX
  2032. CLEAR
  2033.  
  2034. COMMENTS
  2035. This command clears all variable assignments in memory. Using ? MEMORY
  2036. immediately after CLEAR would give no output.
  2037.  
  2038. CLOSE
  2039. PURPOSE
  2040. Closes an input or output channel to a text file or comms line.
  2041.  
  2042. SYNTAX
  2043. CLOSE INPUT/OUTPUT
  2044.  
  2045. COMMENTS
  2046. Only one input channel and one output channel can be open at a time, so you are adivsed to use the CLOSE command when you have completed an I/O task. Unless you close the current channel you will not be able to open a new channel.
  2047. CLOSE also ensure that all data in the disk buffer is written to disk. If you
  2048. have a large disk buffer and a small amount of data, you will notice that some output commands-? LIST, for example-appear to have no effect. What happens is that DML places the data in the buffer before writing it to disk. It remains there until the buffer fills up-or until you execute a CLOSE OUTPUT command. Associated commands are OPEN and INPUT.
  2049.  
  2050. EXAMPLES
  2051. 1    OPEN FILE "aaa" FOR OUTPUT
  2052.     FOR i%=1 to 10:? i%, i%^2:NEXT i%
  2053.     CLOSE OUTPUT
  2054.     OPEN FILE "aaa" FOR INPUT
  2055.     getnext:INPUT LINE a$:? a$
  2056.     IF EOF("*") THEN GOTO getnext
  2057.     CLOSE INPUT
  2058.  
  2059. CLOSE FIELDS
  2060. PURPOSE
  2061. Closes the field list on the current file or another open file.
  2062.  
  2063. SYNTAX
  2064. CLOSE FIELDS[FILE sbfname]
  2065.  
  2066. COMMENTS
  2067. CLOSE FIELDS removes any restrictions on which fields are shown. If you VIEW a record after issuing this command, all its fields will be displayed on screen.
  2068. On its own, CLOSE FIELDS closes the field list for the current file. When FILE sbfname is added, it closes the list for that file.
  2069.  
  2070. EXAMPLES
  2071. 1    CLOSE FIELDS Close field list on current file.
  2072. 2    CLOSE FIELDS FILE "abc" Close field list for file 'abc'.
  2073.  
  2074. CLOSE FILE
  2075. PURPOSE
  2076. Closes all files or a specified file.
  2077.  
  2078. SYNTAX
  2079. CLOSE[ALL]/[FILE sbfname]
  2080.  
  2081. COMMENTS
  2082. CLOSE FILE works in the same way as the equivalent option in the PROJECT menu, but unlike the menu option it also allows you to close all the open files in one go.
  2083.  
  2084. EXAMPLES
  2085. 1    CLOSE Closes the current file.
  2086. 2    CLOSE FILE "aaa" Closes the database file 'aaa'.
  2087. 3    CLOSE ALL Closes all open database files.
  2088.  
  2089. CLOSE FORM
  2090. PURPOSE
  2091. Closes the current Form
  2092.  
  2093. SYNTAX
  2094. CLOSE FORM
  2095.  
  2096. COMMENTS
  2097. This command works in the same way as the Close Form option on the Project
  2098. Menu: it clears the current Form from memory and displays the current file using one of the view modes.
  2099.  
  2100. CLS
  2101. PURPOSE
  2102. Clears the screen.
  2103.  
  2104. SYNTAX
  2105. CLS
  2106.  
  2107. COMMENTS
  2108. CLS makes the output part of the screen-the output window-blank and takes the
  2109. cursor to the top left-hand corner.
  2110.  
  2111. EXAMPLES
  2112. 1    CLS:? "Now at top of cleared screen"
  2113.  
  2114. COL
  2115. PURPOSE
  2116. Returns the cursor's position across the screen.
  2117.  
  2118. SYNTAX
  2119. COL(0)
  2120.  
  2121. COMMENTS
  2122. Use this command to find out the column position of the screen cursor. For the row position, see ROW
  2123.  
  2124. EXAMPLES
  2125. 1    x%=COL(0)
  2126. 2    ? COL(0)
  2127.  
  2128. NOTES
  2129. In practise, Example 2 would be pointless because the statement changes the
  2130. cursor position in the course of printing it.
  2131.  
  2132. COPY
  2133. PURPOSE
  2134. Makes a copy of a file on disk.
  2135.  
  2136. SYNTAX
  2137. COPY from.filename[, ]/[TO]to.filename
  2138.  
  2139. COMMENTS
  2140. Use this command either to copy a file to the same disk under a different
  2141. name, or to copy it to another disk. In the latter case, you can give the file the same name or a new name.
  2142.  
  2143. EXAMPLES
  2144. 1    COPY "aaa", "bbb" Copies 'aaa' to 'bbb'.
  2145. 2    COPY "A:aaa" TO "B:bbb" Copies 'aaa' to drive B under the name 'bbb'.
  2146.  
  2147. COS
  2148. PURPOSE
  2149. Returns the cosine of an angle measured in radians.
  2150.  
  2151. SYNTAX
  2152. COS(nexpr)
  2153.  
  2154. COMMENTS
  2155. To convert an angle in degrees to radians, multiply by PI/180.
  2156. Associated functions are ATN, SIN and TAN.
  2157.  
  2158. EXAMPLES
  2159. 1    numfieldc=COS(numfielda)
  2160. 2    x%=COS(y%)
  2161. 3    x%=COS(VAL(x$))
  2162. 4    ? COS (x%)
  2163.  
  2164. CREATE
  2165. PURPOSE
  2166. Creates a new database file in memory.
  2167.  
  2168. SYNTAX
  2169. CREATE sbfname[:passwords]
  2170.  
  2171. COMMENTS
  2172. CREATE is only the first step in the process of building a new file. To define the file and store it on disk you also need to use ADD and MAKE. The whole process involves the following steps:
  2173.  
  2174. 1. CREATE sbfname
  2175. 2. ADD field
  2176. At this point the file is held in memory and you can check it with ? STATUS
  2177. sbfname.
  2178. 3. MAKE sbfname Writes the file to disk.
  2179.  
  2180. EXAMPLES
  2181. 1    CREATE "Address"
  2182.     ADD "Recno;NUM CON IXU;999999.;0, 0", "SER(~Address~)"
  2183.     ADD "Title;TXT;10;1, 34"
  2184.     ADD "Firstname;TXT;15;3, 6"
  2185.     ADD "Lastname;TXT IXD;20;3, 34"
  2186.     ADD "Street;TXT;30;6, 6"
  2187.     ADD "City;TXT IXD;15;7, 6"
  2188.     ADD "Code;TXT;12;7, 31"
  2189.     ADD "Country;TEXT IXD;15;9, 6"
  2190.     MAKE "Address"
  2191.  
  2192. NOTES
  2193. This sample shows how to set up a simple address file under program control.
  2194. The first ADD statement defines a numeric field which is automatically assigned a record number by means of the SER function. Note the use of the tilde character to enter the filename Address within quotation marks. Following this, the ADD statements define eight text fields which will hold the name and address.
  2195. Once you have defined the file in this way, you could then enter its data under program control, using the commands BLANK and STORE.
  2196.  
  2197. CREATE INDEX
  2198. PURPOSE
  2199. Creates a new index file.
  2200.  
  2201. SYNTAX
  2202. CREATE INDEX ON exp[FILE sbfname][TO index][UNIQUE]
  2203.  
  2204. COMMENTS
  2205. This command is the program equivalent of the New Index option on the Project
  2206. menu.
  2207.  
  2208. EXAMPLES
  2209. 1    CREATE INDEX ON aaa
  2210. 2    CREATE INDEX ON aaa.bbb UNIQUE
  2211. 'bbb' does not need to be the current file, but it must be open.
  2212.  
  2213. DATA
  2214. PURPOSE
  2215. Holds the data(numeric and string constants)that is accessed by a READ
  2216. statement.
  2217.  
  2218. SYNTAX
  2219. DATA constant[, constant][, ......]
  2220.  
  2221. COMMENTS
  2222. The values(constants)following a DATA statement must be separated by commas and text constants must be in quotation marks.
  2223. Because commas are used to separate the constants in a DATA statement, they
  2224. cannot be included in a constant. If you need to insert a comma in your DATA
  2225. items, you can use CHR$(44).
  2226. To insert quotation marks in a string constant, use CHR$(34).
  2227. Date values which are to be read into date fields must be in the correct format (e.g., "ddmmyy" or "mmddyy")and should be enclosed in quotation marks.
  2228. If you intend to use the RESTORE statement, you need to place a label in front of the DATA statement.
  2229.  
  2230. EXAMPLES
  2231. 1    DATA "abcde", 1.04, 2.46, "uvwxyz"
  2232.     data1:DATA 12.2, 12.4, 12.97, 13.4, 9.2, -1
  2233.  
  2234. DATE$
  2235. PURPOSE
  2236. Returns a string from a julian date number.
  2237.  
  2238. SYNTAX
  2239. DATE$(nexpr[, format-strin])
  2240.  
  2241. COMMENTS
  2242. This function expresses a date number as a text string showing the day, month
  2243. and year. The format-string option is used to specify the date format for the
  2244. text string. It must be a valid Superbase format as shown in the entry for
  2245. DATEBASE.
  2246. If the format is given, the text string takes the date format as set with the
  2247. Date Format option on the Set menu, or as specified with the DATEBASE command.
  2248. The complementary function to DATE$ is DAYS. Associated date functions are DAY DAYS DAY$ MONTH MONTH$ YEAR.
  2249.  
  2250. EXAMPLES
  2251. 1    textfieldc=DATE$(datefielda, "ddmmyy")
  2252. 2    textfieldc=DATE$(datefielda + 90)
  2253. 3    textfieldc=DATE$(TODAY)
  2254. 4    x$=DATE$(y%)
  2255. 5    ? DATE$(datefielda + 30)
  2256.  
  2257. NOTES
  2258. Example 3 provides a calculation to insert the system date into a textfield.
  2259. Example 2 gives the date 90 days after the date in datefielda. The Calendar
  2260. adjustment of 1752 has been accounted for.
  2261. Unless you are sure that the date supplied in nexpr will always fall within
  2262. this century, you should set the date format to allow four figures for the year; otherwise you will not be able to distinguish between 1901 and 2001.
  2263. With dates before AD 1000, the four figure year default option does not insert zeroes. AD 55, for example, is shown as 55 and not 0055. If you wish to have four figure years-say, to line up output-add 3653048 to nexpr. As well as ensuring that the date is always expressed as four figures, this is the only way to access AD 0. However, early calendars were not particularly accurate and accurate day counts between two dates cannot be relied on with dates before AD 1400. (Superbase always gives the same answer; history, though, is less
  2264. consistent).
  2265.  
  2266. DATEBASE
  2267. PURPOSE
  2268. Sets the DATE format and TIME format.
  2269.  
  2270. SYNTAX
  2271. DATEBASE string
  2272.  
  2273. COMMENTS
  2274. DATEBASE allows you to specify the format with which Superbase displays the
  2275. date and time. Normally, this format only applies when you use the system
  2276. variables, TODAY and NOW. It does not affect the format of date and time fields, as set in the file definition. This means that if you define a date field with the format "dd-mmm-yy", the command
  2277.     ? datefield
  2278. will display it in this format, irrespective of what the DATEBASE format is.
  2279. However, you can force Superbase to display a date field in the current date
  2280. format by enclosing the field name in parentheses, as in:
  2281.     ? (datefield)
  2282. string must have a valid date or time format, as shown in the examples below.
  2283.  
  2284. EXAMPLES
  2285. 1    DATEBASE "dd mmmm, yyyy"
  2286. Displays the date like this as 10 June 1987
  2287. 2    DATEBASE "dd/mm/yy"
  2288. Display the date as 10/6/87
  2289. 3    DATEBASE "mm-dd-yy"
  2290. Displays the date as 6-10-87
  2291. 4    DATEBASE "dd.mm.yy"
  2292. Displays the date as 6.10.87
  2293. 5    DATEBASE "dd mm yy"
  2294. Displays the date as 6 10 87
  2295. 6    DATEBASE "hh:mm"
  2296. Displays the time as 14:35
  2297. 7    DATEBASE "hh:mm:ss"
  2298. Displays the timeas 14:35:08
  2299. 8    DATEBASE "hh:mm:ss.s"
  2300. Displays the time as 14:35:08.36
  2301. 9    DATEBASE "hh:mm am"
  2302. Displays the time as 2:35 pm
  2303.  
  2304. DAY
  2305. PURPOSE
  2306. Returns the day of the month as a numeric value from a date field or a date
  2307. string.
  2308.  
  2309. SYNTAX
  2310. DAY(nexpr)
  2311.  
  2312. COMMENTS
  2313. The number which DAY returns takes the numeric format as set in the SET-
  2314. NUMERIC FORMAT Superbase menu, or as set with the command DATEBASE. Associated date functions are DATE$ DAY DAY$ MONTH MONTH$ YEAR.
  2315.  
  2316. EXAMPLES
  2317. 1    numfieldc=DAY(datefielda)
  2318. 2    numfieldc=DAY(datefielda + 90)
  2319. 3    numfieldc=DAY(TODAY)
  2320. 4    x%=DAY(datefielda + VAL(textfielda))
  2321. 5    x%=DAY(DAYS("11 Jan 85")
  2322. 6    ?DAY(datefielda + 30)
  2323.  
  2324. NOTES
  2325. Examples 3 provides a calculation to insert the day number of the system date
  2326. into a numeric field.
  2327.  
  2328. DAY$
  2329. PURPOSE
  2330. Returns the day of the week as a text string from a julian date number.
  2331.  
  2332. SYNTAX
  2333. DAY$(nexpr)
  2334.  
  2335. COMMENTS
  2336. Associated date functions are DATE$ DAY DAY$ MONTH MONTH$ YEAR.
  2337.  
  2338. EXAMPLES
  2339. 1    textfieldc=DAY$(datefielda)
  2340. 2    textfieldc=DAY$(datefileda + 90)
  2341. 3    textfieldc=DAY$(TODAY)
  2342. 4    x$=DAY$(DAYS("11 January 1985"))
  2343. 5    x$=DAYS(y%)
  2344. 6    ?DAYS(datefielda + 30)
  2345.  
  2346. NOTES
  2347. Example 3 provides a calculation to insert the weekday of the system date into a textfield. Example 4 provides a weekday for the date shown in quotation marks.
  2348.  
  2349. DAYS
  2350. PURPOSE
  2351. Returns the date as a julian date number from a text string or text field.
  2352.  
  2353. SYNTAX
  2354. DAYS(strexpr) or DAYS(nexpr)
  2355.  
  2356. COMMENTS
  2357. This function returns a number which is the julian day number of the date in
  2358. strexpr(31 December AD 0 has a julian date value of zero). It takes the 1752
  2359. Gregorian reform of the calendar into account.
  2360. strexpr must be in a valid date format.
  2361. A text expression which is not in one of the valid date formats will produce a message 'invalid date format'.
  2362. Associated date functions are:DATE$ DAY DAY$ MONTH MONTH$ YEAR.
  2363.  
  2364. EXAMPLES
  2365. 1    numfieldc=DAYS(textfielda)
  2366. 2    numfieldc=DAYS(datefielda + 90)
  2367. 3    numfieldc=DAYS("11 jan 85")
  2368. 4    x%=DAYS(a$) + 90
  2369.  
  2370. NOTES
  2371. In example 2, the use of DAYS is redundant.
  2372.  
  2373. DELETE
  2374. PURPOSE
  2375. Deletes a file stored on disk.
  2376.  
  2377. SYNTAX
  2378. DELETE filename
  2379.  
  2380. COMMENTS
  2381. This command has the same effect as the ERASE command in MS DOS and DELETE in
  2382. Amiga DOS. To delete a file on a drive or directory other than the current one, you need to place the path name in front of the file name.
  2383.  
  2384. EXAMPLES
  2385. 1    DELETE "aaa"
  2386. 2    DELETE "b:aaa"
  2387. 3    DLETE "DF0:aaa"
  2388.  
  2389. DIM
  2390. PURPOSE
  2391. Defines array variables
  2392.  
  2393. SYNTAX
  2394. DIM variablename(nexpr[, nexpr][, nexpr])
  2395.  
  2396. COMMENTS
  2397. Arrays can have up to three dimensions. nexpr specifies the number of elements in each dimension of an array. The maximum number of elements is limited only by the amount of available memory.
  2398. A single DIM statement can be used to define more than one array. If DIM is
  2399. used in this way, each array defintion should be separated by commas.
  2400. Note that the first element in an array dimension has the subscipt 0.
  2401.  
  2402. EXAMPLES
  2403. 1    DIM x%(20)
  2404. Defines a one dimensional numeric array with 21 elements.
  2405. 2    DIM b$(10)
  2406. 3    DIM x%(3, 10)
  2407. 4    DIM b$(2, 12)
  2408. 5    DIM a$(20), n%(2, 3, 10), c$(2, 10)
  2409.  
  2410. DIRECTORY
  2411. PURPOSE
  2412. Changes the current directory.
  2413.  
  2414. SYNTAX
  2415. DIRECTORY "path"
  2416.  
  2417. COMMENTS
  2418. Directory can be used to switch to a directory on another drive or to a
  2419. different directory in the same drive.
  2420.  
  2421. EXAMPLES
  2422. 1    DIRECTORY "dh0:mydir/testdir"
  2423. 2    x$="a:":DIRECTORY x$
  2424. 3    C:/Images
  2425.  
  2426. DISKSPACE
  2427. PURPOSE
  2428. Shows the amount of space remaining on a disk.
  2429.  
  2430. SYNTAX
  2431. DISKSPACE(strexpr)
  2432.  
  2433. COMMENTS
  2434. This function gives the number of unused bytes on a disk. On the Amiga, the disk name given in strexpr can be either a drive name or a volume name(i.e.,  a diskname such as Mydisk:). On the Amiga, the diskname must end in a colon. Note also that the free block given by the CLI are 488 byte blocks.
  2435.  
  2436. EXAMPLES
  2437. 1    Diskspace "df0:"
  2438. 2    DISKSPACE ("Mydisk:")
  2439. 3    x$="df1:":x%=DISKSPACE(x$)
  2440. 4    ? "Remaining diskspace is: ";DISKSPACE("a:");"bytes"
  2441.  
  2442. EDIT
  2443. PURPOSE
  2444. Allows the user to edit a program, a text file, a Query, or an Update.
  2445.  
  2446. SYNTAX
  2447. EDIT [TEXT]/[QUERY]/[UPDATE]
  2448.  
  2449. COMMENTS
  2450. Depending on which option has been selected, EDIT displays a window or a dialog.
  2451. EDIT QUERY displays the query dialog.
  2452. EDIT UPDATE displays the update filter dialog.
  2453. EDIT TEXT opens the text editor window.
  2454. If none of the three options has been selected, EDIT opens the program window.
  2455. After EDIT has opened a window or dialog, you can edit the information, just as you would if you had selected one of the Edit options from the Superbase menus for example, Edit Program from the Advanced menu, or Edit Query from the Process menu. The difference is that when you exit from the window or dialog, control returns to the program.
  2456. To exit from a window, close the window by clicking on the close gadget in the top left-hand corner. You exit from a dialog by clicking on OK or Cancel. In Superbase itself, clicking on OK takes the user out of the dialog, and then runs the query or update;clicking on OK after EDIT returns control to the program without executing a query or an update.(To run a query, use ? QUERY, and use UPDATE to carry out an update.)
  2457.  
  2458. EJECT
  2459. PURPOSE
  2460. Ejects the current page on the printer or feeds in a new page when the number
  2461. of lines remaining is less than the number specified.
  2462.  
  2463. SYNTAX
  2464. EJECT[nexp]
  2465.  
  2466. COMMENTS
  2467. EJECT on its own has the same effect as pressing the Form Feed button on the
  2468. printer. It sends a Form Feed character to the printer, which then moves the
  2469. current page on and feeds in the next.
  2470. If nexp is used, the page is ejected when the number of lines at the bottom of the page is less than nexp.
  2471.  
  2472. EXAMPLES
  2473. 1    EJECT
  2474. 2    EJECT 3
  2475. Feeds in a new page if there are less than three lines left at the bottom of
  2476. the current page.
  2477.  
  2478. END
  2479. PURPOSE
  2480. Terminates program execution.
  2481.  
  2482. SYNTAX
  2483. END
  2484.  
  2485. COMMENTS
  2486. This command brings a program to a halt and returns control to the Superbase
  2487. Menu system. END is optional and if you do not include it, DML will return
  2488. control to Superbase when it reaches the last statement in a program.
  2489.  
  2490. EXAMPLES
  2491. 1    IF EOF("aaa") THEN END
  2492.  
  2493. END GROUP
  2494. SYNTAX
  2495. END GROUP
  2496.  
  2497. PURPOSE
  2498. Marks the end of a BEFORE GROUP or AFTER GROUP section.
  2499.  
  2500. COMMENTS
  2501. A BEFORE GROUP or AFTER GROUP section in a Report program must end with an END
  2502. GROUP statement. If it doesn't, Superbase will be unable to tell which
  2503. statements below to which section.
  2504.  
  2505. END HEADING
  2506. PURPOSE
  2507. Marks the end of a HEADING section in a Report program.
  2508.  
  2509. SYNTAX
  2510. END HEADING
  2511.  
  2512. COMMENTS
  2513. A HEADING section defines the headings for a report. It must start with the
  2514. keyword HEADING, followed by one or more '?' statements which specify the
  2515. heading information. END HEADING must be placed at the end of the section.
  2516.  
  2517. END REPORT
  2518. PURPOSE
  2519. Marks the end of an AFTER REPORT or BEFORE REPORT section.
  2520.  
  2521. SYNTAX
  2522. END REPORT
  2523.  
  2524. COMMENTS
  2525. END REPORT must be placed at the end of the set of statements that constitute
  2526. an AFTER REPORT or BEFORE REPORT section in a Report program. Superbase
  2527. automatically generates END REPORT statements at the end of these sections when you create a report using the Forms Editor's reporting facility.
  2528.  
  2529. ENTER
  2530. PURPOSE
  2531. Allows the user to enter data in the current file or to edit the data in a
  2532. record.
  2533.  
  2534. SYNTAX
  2535. ENTER[field]/[nexpr][, nexpr2]
  2536.  
  2537. COMMENTS
  2538. ENTER works on the current file. Used on its own, it is equivalent to the Record menu option Edit. It displays the current record and allows you to edit it field by field, starting with the first field. In effect, ENTER temporarily hands over control from DML to Superbase itself. When you press Return after the last field in a record or when you move the cursor down to the bottom of the record, control is transferred back to DML.
  2539. If field or nexpr is used, Superbase restricts the editing to just one field.
  2540. You can supply either a field name or a field number where the number
  2541. corresponds to the field's position in the field list;i.e., if there are six
  2542. fields in a record, the number for the first field is 1 and the number for the last field in 6. When you enter the record, Superbase makes the editing cursor active in the field specified and transfers control back to DML when you press Return.
  2543. With the second numeric parameter, nexpr2, you can specify that a range of fields is available for editing, field or nexpr1 gives the starting point, nexpr2 gives the number of fields that can be edited - from the first field after field on nexpr1 onwards. For example, if the command was:
  2544.     ENTER 3, 5
  2545. you would be able to edit fields 3 to 8.
  2546. You may want to specify a starting point without restricting the yourself to a given number of fields. To do this, enter 0 as the second numeric parameter; e.g.:
  2547.     ENTER Lastname, 3
  2548. would make the cursor active in Lastname and would allow you to edit Lastname and the next three fields.
  2549. ENTER works with the current view mode or Form. Note that if you have set the
  2550. Field Order on the Form, Superbase will take the first record(in the order you have specified)as the starting point for data entry and editing.
  2551. When used in conjunction with BLANK, ENTER is wquivalent to the Record menu
  2552. option New, and allows you to enter data into a new record.
  2553. This command does not save a record;to save a new or edited record use the
  2554. command STORE.
  2555.  
  2556. EXAMPLES
  2557. 1    OPEN FILE "aaa"
  2558.     ASK "Record to edit";x$
  2559.     SELECT KEY x$
  2560.     ENTER
  2561.     STORE
  2562. 2    OPEN FILE "aaa"
  2563.     BLANK
  2564.     ENTER
  2565.     STORE
  2566. 3    ENTER Lastname
  2567. 4    ENTER 4, 2
  2568.  
  2569. Example 1 shows how to enter an existing record in order to edit it. Example 2 creates a new record. Example 3 restricts editing to the Lastname field. In the last example, fields 4 to 6 can be edited.
  2570.  
  2571. EOF
  2572. PURPOSE
  2573. Detects the end of a database file when reading through it under program
  2574. control.
  2575.  
  2576. SYNTAX
  2577. EOF(strexpr)
  2578.  
  2579. COMMENTS
  2580. strexpr should contain the name of a currently open file. If DML reaches the
  2581. end of a file, EOF is set to -1 (true); otherwise it is set to 0(false). EOF is only used under program control.
  2582. Supplying the empty string as an argument-EOF("")-allows you to refer to the
  2583. current file without giving the file name. For example, to define a function key which was equivalent to the Fast Forward button, you would enter:
  2584.     WHILE NOT EOF(""):SELECT NEXT:VIEW:WEND
  2585. EOF can also be used to detect the end of a text file. For this purpose it
  2586. takes the string "*" as an argument, and not the file name;that is, EOF("*") is set to 'true' when the end of a text file is found.
  2587. EOF is only set and unset by the SELECT record selection commands exculding
  2588. SELECT KEY(which only set the FOUND function). In other words it is possible to search through a file with a filter, and set EOF to 'true' by not finding a record, and then to use the 'key-lookup'(SELECT KEY)to look for a record outside the filter. If you do this, FOUND will reflect the success of the 'key-lookup' operation, while EOF will show that you are at the end of the file.
  2589.  
  2590. EXAMPLES
  2591. 1    ? EOF(x$)
  2592.     OPEN FILE "aaa";SELECT FIRST:
  2593.     IF EOF("aaa")THEN GOTO fempty
  2594.     loop1:SELECT NEXT:IF EOF("aaa")THEN GOTO fend
  2595.     ....
  2596.     GOTO loop1
  2597.     fempty: ? "FILE 'aaa' has no records";END
  2598.     fend: ? "Process completed";END
  2599.  
  2600. ERASE
  2601. PURPOSE
  2602. Clears a variable assignment from memory.
  2603.  
  2604. SYNTAX
  2605. ERASE varlist
  2606.  
  2607. COMMENTS
  2608. This command clears a variable or a list of variables from memory. If several
  2609. variables are to be cleared, varlist should contain a list of variable names
  2610. separated by commas.
  2611. If you specify the name of an array, ERASE clears all the elements in the array (it also clears any other variable with the same name as the array).
  2612.  
  2613. EXAMPLES
  2614. 1    ERASE x$
  2615. 2    ERASE a%, b%, c%, d%, a$, b$
  2616. 3    a$="Fred"
  2617.     a%=2.35
  2618.     MEMORY
  2619.     ERASE a$
  2620.     MEMORY
  2621.  
  2622. NOTES
  2623. The most obvious use for this command is to tidy up the variables in memory
  2624. before CHAINing another program or before OUTPUT TO "aaa" MEMORY. You could
  2625. then use SET "aaa" to pass some values to variables in the new program.
  2626.  
  2627. ERR$
  2628. PURPOSE
  2629. Returns the text message associated with an error number.
  2630.  
  2631. SYNTAX
  2632. ERR$(nexpr)
  2633.  
  2634. COMMENTS
  2635. This function returns a text string containing the error message associated
  2636. with the error number given in nexpr.
  2637. Use this function in conjunction with the control flow commands ON ERROR and
  2638. RESUME, and the system variable ERRNO.
  2639.  
  2640. EXAMPLES
  2641. 1    ? ERR$(ERRNO)
  2642.     CLS:NUMBASE "z9999"
  2643.     FOR i%=1 to 130
  2644.     ? "Error number";i%, " ";ERR$(i%)
  2645.     NEXT i%
  2646. 3    x$=ERR$(14)
  2647.  
  2648. Example 2 displays a list of error numbers with their associated error
  2649. messages.
  2650.  
  2651. ERRNO
  2652. PURPOSE
  2653. Returns the number of the last error that occurred.
  2654.  
  2655. SYNTAX
  2656. ERRNO
  2657.  
  2658. COMMENTS
  2659. ERRNO is used in conjunction with the error handling commands ON ERROR and
  2660. RESUME and with the function ERR$ which gives the error messge associated with an error number.
  2661.  
  2662. EXAMPLES
  2663. 1    x%=ERRNO
  2664. 2    ? ERR$(ERRNO)
  2665.  
  2666. NOTES
  2667. Example 2 displays the error message associated with the last error which
  2668. occurred.
  2669.  
  2670. EXECUTE
  2671. PURPOSE
  2672. Executes a text string as though it were a command.
  2673.  
  2674. SYNTAX
  2675. EXECUTE string
  2676.  
  2677. COMMENTS
  2678. Any set of commands, statements, and functions that can be carried out as a
  2679. single program line can be placed in a string and then executed.
  2680.  
  2681. EXAMPLES
  2682. 1    EXECUTE "SELECT CURRENT:VIEW:WAIT FOR 5"
  2683.     y$="REQUEST ~ OK/CANCEL Requestor ~, ~~, 1"
  2684.     EXECUTE y$
  2685.  
  2686. NOTES
  2687. Example 2 suggests a way of using this function to set up a user-defined dialog which can be called from different points in a program. Note the use of the tilde character to embed quotation marks in a string.
  2688.  
  2689. EXP
  2690. PURPOSE
  2691. Returns the value of the mathematical constant 'e' raised to a power.
  2692.  
  2693. SYNTAX
  2694. EXP(nexpr)
  2695.  
  2696. COMMENTS
  2697. EXP gives the value of 'e' to the power of expr.
  2698. nexpr has a maximum absolute value of 709.7827128934, and a range of
  2699. -709.7827128934 to + 709.7827128934. This in turn gives the largest number that Superbase can hold - 1.797693134862 times 10 to the power 308.
  2700.  
  2701. EXAMPLES
  2702. 1    numfieldc=EXP(numfielda)
  2703. 2    numfieldc=EXP(datefielda-datefield)
  2704. 3    numfieldc > EXP(numfielda & numfield)
  2705. 4    x%=EXP(y%)
  2706. 5    x%=EXP(y% * numfielda * (datefielda-datefield))
  2707. 6    x%=EXP (VAL(RIGHT$(textfielda, 5)))
  2708. 7    ? EXP(x%)
  2709.  
  2710. EXPORT
  2711. PURPOSE
  2712. Exports data to an external text file from the current file.
  2713.  
  2714. SYNTAX
  2715. EXPORT[FILE sbfname[INDEXindex][TO]filename
  2716. [WHEREconditions] [USINGparams]
  2717.  
  2718. COMMENTS
  2719. This command is the program equivalent of the EXPORT option in the PROCESS
  2720. menu. It creats a text file on disk using the data from an sbf file. The only
  2721. compulsory parameter is filename, which gives the name of the text file.
  2722. If FILE sbfname is not specified, EXPORT takes data from the current open file.
  2723. Similarly, unless INDEX indexname is given, the command exports records in the order of the current index.
  2724. WHERE conditions allows you to creates a filter to determine which records are copied to the text file.conditions is set up in the same way as the command string in the Filter requestor.
  2725. USING parameters allows you to change the Export/Import parameters as specified by SET-OPTIONS. These determine what characters Superbase uses to separate fields and records in the text file. You can also specify whether text fields are exported with or without quotation marks around them.
  2726. USING takes three parameters, each enclosed by quotation marks and separated by commas. For example:
  2727.     USING "&", "$$", "0"
  2728. The first two parameters specify the field separation characters and the record separation characters. As in SET-OPTIONS, you can define a separator using one character or two characters. The third parameter must be eith 0 or 1;0 for no quotation marks,  1 to include quotation marks.
  2729. If you want to use a non-printing character-the carriage return character or
  2730. the line feed character, for example-as a separator, you need to enter its ASCII code with the CHR$ function. For example:
  2731.     USING "&", CHR$(13) + CHR$(10), "0"
  2732. defines the record separator as the carriage return character followed by the
  2733. line feed character.
  2734.  
  2735. EXAMPLES
  2736. 1    EXPORT "aaa.exp"
  2737. 2    EXPORT FILE "aaa" INDEX fielda TO "aaa.exp" WHERE
  2738.     (datefield) < DAYS ("29 Apr 87")
  2739. 3    EXPORT FILE "aaa" TO "aaa.exp" USING "&", "##", "1"
  2740.  
  2741. FCASE$
  2742. PURPOSE
  2743. Converts the first letter of a string to upper case, leaving the rest of the
  2744. string in lower case.
  2745.  
  2746. SYNTAX
  2747. FCASE$(strexpr)
  2748.  
  2749. COMMENTS
  2750. FCASE$ takes a word and makes the first letter a capital letter.
  2751. Associated functions are LCASE$ and UCASE$.
  2752.  
  2753. EXAMPLES
  2754. 1    textfielda=FCASE$(textfielda)
  2755. 2    x$=FCASE$(y$)
  2756. 3    x$=FCASE$("ABCDEF")
  2757. 4    ? FCASE$(x$)
  2758.  
  2759. FILE
  2760. PURPOSE
  2761. Marks an open file the current file.
  2762.  
  2763. SYNTAX
  2764. FILE sbfnam
  2765.  
  2766. COMMENTS
  2767. When several files have been opened, you can use FILE to make one of them the
  2768. current file.
  2769.  
  2770. EXAMPLES
  2771. 1    FILE "aaa"
  2772. 2    x$="bbb":FILE x$
  2773. 3    a$="address":b$="bank"
  2774.     OPEN FILE a$:SELECT FIRST
  2775.     OPEN FILE b$:SELECT FIRST
  2776.     PAGING OFF
  2777.     f$=b$
  2778.     lab1:VIEW:WAIT x$
  2779.     IF EOF(a$) OR EOF(b$) THEN END
  2780.     IF f$=b$ THEN f$=a$ ELSE f$=b$
  2781.     FILE f$:SELECT NEXT
  2782.     GOTO lab1
  2783.  
  2784. NOTES
  2785. The third example shows how you can display records from two(or more)files at
  2786. the same time. It displays one record after another, alternating between two
  2787. files until it reaches the end of the shorter file.
  2788.  
  2789. FIX
  2790. PURPOSE
  2791. Sets the accuracy with which DML stores a number and performs calculations on
  2792. it.
  2793.  
  2794. SYNTAX
  2795. FIX(nexpr1, nexpr2)
  2796.  
  2797. COMMENTS
  2798. FIX allows you to limit a numeric expression to a specified number of decimal
  2799. places. nexpr2 is the number of decimal places that nexpr1 is evaluated at.
  2800. Superbase stores numeric variables at 13 figure accuracy, so the fraction 1/3 is stored as 0.3333333333333. Adding two of these together gives 0.6666666666667.
  2801. If you set the numeric format to two decimal places in a file definition, 
  2802. Superbase would show this result as:0.33 + 0.33=0.67.
  2803. This is not incorrect, especially if you are a scientist or engineer, but it is not very helpful if you are using a Query to produce an invoice. FIX(1/3, 2) stores the fraction 1/3 as 0.330000000000, so FIX(1/3, 2) + FIX(1/3, 2) gives result as 0.66.
  2804. Note that numeric fields with two decimal places are automatically FIXed.
  2805.  
  2806. EXAMPLES
  2807. 1    numfieldc=FIX(numfielda, 3)
  2808. 2    numfieldc=FIX(datefielda-datefieldb, 0)
  2809. 3    numfieldc > FIX(numfielda * numfieldb, 4)
  2810. 4    $x=FIX($y, 2)
  2811. 5    $x=FIX($y * numfielda * (datefielda-datefieldb), 2)
  2812. 6    $x=FIX(VAL (RIGHT$(textfielda, 5)), 2)
  2813. 7    ? FIX($x)
  2814.  
  2815. FOOTING
  2816. PURPOSE
  2817. Sets the Report footing for every page.
  2818.  
  2819. SYNTAX
  2820. FOOTING nexpr
  2821.  
  2822. COMMENTS
  2823. FOOTING is followed by a number of ? statements specifying the information that will appear at the bottom of every page in a report. These must be followed by an END FOOTING statement.
  2824. nexpr specifies the number of lines required for the report footing. Make sure that the number of lines output by your ? statements is the same as the number specified by nexpr.
  2825.  
  2826. EXAMPLES
  2827. 1    FOOTING 1
  2828.     ? "Page";PG
  2829.     END FOOTING
  2830.  
  2831. NOTES
  2832. This examples uses the system variable PG to print the page number. See the
  2833. entry HEADING for more details.
  2834.  
  2835. FOR TO NEXT
  2836. PURPOSE
  2837. Repeats a series of program statements a specified number of times.
  2838.  
  2839. SYNTAX
  2840. FOR var=nexp1 TO nexp2[STEP nexp3]statements NEXT[var][, var]...
  2841.  
  2842. COMMENTS
  2843. This command sets up a program loop in which the statements between FOR TO and NEXT are executed a given number of times, using var as a counter. nexp1 sets the initial value of the counter and nexp2 sets the final value.
  2844. If STEP nexp3 is not included, the counter is increased by one every time the
  2845. program executes the statements inside the loop;that is, every time it passes
  2846. from FOR to NEXT. When the counter reaches the value set in nexp3, the program moves on to the next statement after NEXT.
  2847. When STEP nexp3 is included, the program increases the counter by the amount
  2848. specified in nexp3.
  2849. var must be a numeric variable;nexp1, nexp2, nexp3 can be any numeric expression, including other numeric variables.
  2850. You can use FOR TO NEXT on the same line with multiple statements, or on
  2851. multiple lines. But if there is more than one statement between FOR and NEXT, it is advisable to put each on a separate line.
  2852. If a number of FOR NEXT loops end at the same point, you can use a single NEXT
  2853. statement for all of them.
  2854.     NEXT n%, y%, z%
  2855. is the same as
  2856.     NEXT n%
  2857.     NEXT y%
  2858.     NEXT z%
  2859.  
  2860. EXAMPLES
  2861. 1    FOR i%=1 to 10:? i%, i% ^ 2:NEXT
  2862. 2    weekcount%=1
  2863.     FOR i%=DAYS("01/01/87")TO DAYS("31/03/87")STEP 7
  2864.     FOR j%=0 to 6:k%=i% + j%
  2865.     ? DAY(k%);" ";MONTH$(k%), DAY$(k%)
  2866.     NEXT j%
  2867.     weekcount%=weekcount% + 1
  2868.     NEXT i%
  2869.  
  2870. Example 2 prints out the weekdays for the first quarter of 1987 in weeks.
  2871.  
  2872. FORM
  2873. PURPOSE
  2874. Specifies which part of a Form is displayed in the database window.
  2875.  
  2876. SYNTAX
  2877. FORM page[, row, col]
  2878.  
  2879. COMMENTS
  2880. This command is used to select a particular page within a multi-page form or to bring part of a page that is outside the database window into view.
  2881. page must be a numeric expression specifying the page number.row and col must
  2882. be numeric expressions which give a row and column position within the page.
  2883. Form will then move the page so that the specified position is at the top
  2884. left-hand corner of the database window.
  2885.  
  2886. EXAMPLES
  2887. 1    FORM 2
  2888. Selects page 2 in the Form currently displayed.
  2889. 2    FORM 1, 24, 1
  2890. Makes row 24, column 1 of page 1 appear at the top left-hand corner of the
  2891. database window.
  2892.  
  2893. FOUND
  2894. PURPOSE
  2895. Detects whether a key lookup has been successful or not.
  2896.  
  2897. SYNTAX
  2898. FOUND(strexpr)
  2899.  
  2900. COMMENTS
  2901. After you have issued a SELECT KEY command to search for a particular record, 
  2902. FOUND will tell you whether the record has been found. If the search is
  2903. successful, FOUND returns a value of -1(true);if the search is unsuccessful, 
  2904. FOUND returns 0.
  2905. strexpr should contain the file name of '.sbf' file which has already been
  2906. opened. However, you can use the empty string-as in FOUND("")-to refer to the
  2907. current file.
  2908. FOUND is only set and cleared by the SELECT KEY and LOOKUP commands.
  2909.  
  2910. EXAMPLES
  2911. 1    SELECT KEY "London"
  2912.     ? FOUND("")
  2913. 2    a$="Clients":SELECT KEY "Smith" FILE a$
  2914.     IF FOUND(a$)THEN ? "Smith found" ELSE ? "No Smiths"
  2915.  
  2916. FREE
  2917. PURPOSE
  2918. Returns the amount of free memory.
  2919.  
  2920. SYNTAX
  2921. FREE(nexpr)
  2922.  
  2923. COMMENTS
  2924. This function returns a number showing how much free memory there is. On the
  2925. Amiga, nexpr determines whether the figure refers to chip, contiguous or fast
  2926. memory.
  2927.  
  2928. 0=total free memory
  2929. 2=chip memory
  2930. 4=fast memory
  2931. Adding 2^17 to one of these parameters gives the largest block of memory in its respective memory area. So, 2^17 + 2 gives the maximum area of contiguous chip memory.
  2932.  
  2933. EXAMPLES
  2934. 1    ? FREE(0)
  2935. 2    x%=FREE(i%)
  2936.  
  2937. GET
  2938. PURPOSE
  2939. Gets a character from the keyboard.
  2940.  
  2941. SYNTAX
  2942. GET strvar/field
  2943.  
  2944. COMMENTS
  2945. This command reads a character from the keyboard into a string variable or a
  2946. text field. It does not wait for a keystroke, and if no key is pressed it
  2947. returns an empty string. If you want GET to wait until a key is pressed, you
  2948. need to place it in a loop, as in:
  2949.     LABEL:GET A$:IF A$=: ""  GOTO LABEL
  2950. Alternatively, use the WAIT command.
  2951.  
  2952. GOSUB
  2953. PURPOSE
  2954. Calls a procedure or subroutine.
  2955.  
  2956. SYNTAX
  2957. GOSUB label
  2958.  
  2959. COMMENTS
  2960. Like the GOTO statement, GOSUB transfers control to a different part of the
  2961. program: it causes the program to branch to the label specified. But unlike
  2962. GOTO, it remembers where it branched from. When the program meets a RETURN
  2963. statement, it jumps back to the line following the GOSUB statement.
  2964. GOSUB is used to call a subroutine;that is, one or more program lines which
  2965. perform a specific task and can be called from different places within the main program. Subroutines are useful if the same task needs to be performed at several different stages in the program. Instead of repeating a group of lines, it saves space and is more convenient to put them in a subroutine.
  2966. In DML, a subroutine is defined by a label at the beginning and a RETURN
  2967. statement at the end.
  2968.  
  2969. EXAMPLES
  2970. 1    GOSUB sub1
  2971. 2    x$=Address(1):GOSUB label1
  2972.     x$=Address(2):GOSUB label1
  2973.     .....
  2974.     .....
  2975.     .....
  2976.     label1:
  2977.     ? "This subroutine outputs x$ to the printer"
  2978.     PRINT x$
  2979.     DISPLAY;
  2980.     RETURN
  2981.  
  2982. GOTO
  2983. PURPOSE
  2984. Transfers control to another part of the program.
  2985.  
  2986. SYNTAX
  2987. GOTO label
  2988.  
  2989. COMMENTS
  2990. This statement makes the program jump to the label specified, instead of
  2991. continuing to the next line in the program. It alters the order in which DML
  2992. executes a program. This kind of control transfer is called an uncoditional
  2993. jump. For conditional jumps, see the ON GOTO and the IF THEN ELSE statement.
  2994.  
  2995. EXAMPLES
  2996. 1    GOTO fred
  2997.     ....
  2998.     ....
  2999.     fred:....
  3000.  
  3001. GROUP
  3002. PURPOSE
  3003. Specifies the field on which a report is grouped and the field(s) for which
  3004. subtotal reporting is required.
  3005.  
  3006. SYNTAX
  3007. GROUP fieldname [, fieldname] [.....]
  3008.  
  3009. COMMENTS
  3010. Superbase insets a GROUP statement in a report program when you specify fields with the GROUP option on the Forms Editor's Report menu. GROUP has two main functions. First, it defines the field on which Superbase groups data in a report. Second, it specifies any other fields for which subtotals-or other
  3011. reporting features such as MAX and MEAN-are required.
  3012. If you wish to specify several levels of grouping, you should enter a separate GROUP statement for each level.
  3013. GROUP can also be used in an AFTER GROUP section as a reference for the field
  3014. which defines the group. Since the group has already changed, entering the field name would output the data for the next group;GROUP allows you to retrieve the data for the previous group-i.e., the group for which the AFTER GROUP section provides reporting information such as subtotals and record counts.
  3015.  
  3016. EXAMPLES
  3017. 1    GROUP City, amount
  3018. 'City' is field on which the report is grouped, 'amount' is a field for which
  3019. subtotals are required-the AFTER GROUP section may include the statement:
  3020.     SUM amount
  3021. 2    GROUP Country
  3022.     GROUP City, amount
  3023. In this example, record data is grouped at two levels:City within Country.
  3024.  
  3025. HEADING
  3026. PURPOSE
  3027. Sets the Report heading for each page.
  3028.  
  3029. SYNTAX
  3030. HEADING
  3031.  
  3032. COMMENTS
  3033. Superbase generates a HEADING statement when you specify a report heading using the Heading option on the Forms Editor's Report menu. This statement marks the start of a HEADING section and is followed by one or more statements which define the heading for a report. The section must end with an END HEADING statement.
  3034. If you wish to include the page number in a heading, use the system variable
  3035. PG, as in:
  3036.     ? @32, "Page";PG
  3037. PG is set to one when the Report Select command is executed and incremented by one after each page.
  3038.  
  3039. EXAMPLES
  3040. 1    HEADING
  3041.     ? @22;BF;U;"DEPOSITS REPORT on", TODAY, "at", NOW;ATTR
  3042.     OFF
  3043.     END HEADING
  3044.  
  3045. HOME
  3046. PURPOSE
  3047. Takes the cursor to the top left-hand corner of the screen.
  3048.  
  3049. SYNTAX
  3050. HOME
  3051.  
  3052. COMMENTS
  3053. Home moves the cursor to the top of the screen without clearing the screen. The next screen output will now appear at that position.
  3054. HOME is useful when you want to overwrite something you have previously
  3055. displayed on screen, or when you want to move the cursor up the screen or
  3056. backwards. Normally, if you attempt to do this with LOCATE or using the @
  3057. parameter with the ? command, DML displays the next page. HOME allows you to
  3058. display text and numbers anywhere on screen, no matter what has been displayed previously.
  3059.  
  3060. EXAMPLES
  3061. 1    CLS
  3062.     FOR r%=1 to 18
  3063.     FOR c%=1 to 80
  3064.     HOME:LOCATE c%, r%: ? "Hello"
  3065.     NEXT
  3066.     NEXT
  3067.  
  3068. HRS
  3069. PURPOSE
  3070. Extracts the number of hours from a numeric expression containing the time in
  3071. thousandths of a second.
  3072.  
  3073. SYNTAX
  3074. HRS(nexpr)
  3075.  
  3076. COMMENTS
  3077. nexpr will usually be a time field or the result of a TIMEVAL expression.
  3078.  
  3079. EXAMPLES
  3080. 1 hr%=HRS(timefield)
  3081.  
  3082. IF THEN ELSE
  3083. PURPOSE
  3084. Executes a statement if a condition is true.
  3085.  
  3086. SYNTAX
  3087. IF exp THEN statements[END IF][ELSE statements][END IF]
  3088.  
  3089. COMMENTS
  3090. exp can be any expression-string, numeric or logical-which is capable of being true or false.
  3091. For example, A$="Smith" is either true or false, so:
  3092.     IF A$="Smith" THEN...
  3093. is a valid statement, but
  3094.     IF A$ THEN...
  3095. is not.
  3096. If exp is true, DML executes the statement or statements after THEN. Otherwise it proceeds to the next statement after the IF THEN statement.
  3097. THEN can be omitted when it is followed by GOTO. For example:
  3098.     IF exp GOTO label
  3099. is the same as
  3100.     IF exp THEN GOTO label
  3101. By including the ELSE option, you can instruct DML to choose between two courses of action. It executes the statements after THEN if exp is true;if exp is false, it executes the statments after ELSE.
  3102. An IF THEN ELSE statement can be split up so that it is placed on several
  3103. lines. If you do this, the statements after THEN must start on a new line, and ELSE must also start on a new line. For example:
  3104.     IF x% > y% THEN ? "Greater than" ELSE ? "Less than or equal"
  3105. can be written as:
  3106.     IF x% > y% THEN
  3107.     ? "Greater than"
  3108.     ELSE
  3109.     ? "Less than or equal"
  3110.     END IF
  3111. END IF marks the end of the IF THEN ELSE statement. It should always be used
  3112. when ELSE is placed on a separate line. If it is not used, DML assumes that all the separate line statements in the rest of the program belong to ELSE.
  3113. END IF is also used when the ELSE option has not been selected, but the
  3114. statements following THEN are placed on separate lines. For example:
  3115.     IF b$="Yes" THEN n%=1:z%=2:GOSUB label
  3116. can be written:
  3117.     IF b$="Yes" THEN
  3118.     n%=1
  3119.     z%=2
  3120.     GOSUB label
  3121.     END IF
  3122.     .....
  3123.     .....
  3124. Here too, END IF is used to tell DML where the statements belonging to THEN
  3125. finish.
  3126. exp does not always need to contain an operator. Remember that DML assigns a
  3127. value of 0 to false expressions and -1 to true expressions. With IF THEN
  3128. commands, though, DML treats a numeric expression with any value other than zero as true. And it treats a numeric expression with any value other than -1 as false.
  3129.     IF EOF("") THEN .....
  3130. implies:
  3131.     IF EOF("") <> 0 THEN...
  3132. Likewise, 
  3133.     IF NOT EOF("") THEN...
  3134. implies
  3135.     IF EOF("") <> -1 THEN
  3136.  
  3137. EXAMPLES
  3138. 1    IF exp THEN x%=x% + 1
  3139.     IF exp THEN x$="TRUE"
  3140.     IF exp THEN x%=x% + 1:x$="TRUE"
  3141.     IF exp THEN labltrue
  3142.     IF exp THEN GOTO labltrue
  3143. 2    IF exp THEN x$="TRUE" ELSE x$="FALSE"
  3144.     IF exp THEN x$="TRUE":x% + 1 ELSE x$="FALSE"
  3145.     IF exp THEN labltrue ELSE lablfalse
  3146.     IF exp THEN GOTO labltrue ELSE GOTO lablfalse
  3147. 3    IF b$=MID$(a$, 3, 1)THEN
  3148.     x%=1
  3149.     GOSUB label1
  3150.     ELSE
  3151.     x%=2
  3152.     GOSUB label2
  3153.     END IF
  3154. 4    IF a$="Y" or a$="y" THEN
  3155.     ? "Yes"
  3156.     ELSE
  3157.     IF a$="N" or a$'"n" THEN
  3158.     ? "No"
  3159.     ELSE
  3160.     ? "Other"
  3161.     END IF
  3162.  
  3163. NOTES
  3164. Example 4 shows how IF THEN statements can be nested. In this case, the second IF THEN statement is only executed if the condition in the first statement gives a false result.
  3165.  
  3166. IMPORT
  3167. PURPOSE
  3168. Imports an external text file into an open file.
  3169.  
  3170. SYNTAX
  3171. IMPORT filename [TO FILEsbname] [WHERE conditions] [USING parameters]
  3172.  
  3173. COMMENTS
  3174. This command imports the ASCII text file specified by filename into the current file or into the file specified by sbfname. It works in the same way the IMPORT option in the PROCESS menu.
  3175. IFTOFILE sbfname is not specified, the text file is imported into the current
  3176. open file. If it is specified, sbfname must be an open file.
  3177. WHERE conditions allows you to add a filter to the command.conditions is set up in the same way as the command string in the Filter dialog.
  3178. USING parameters can be used to change the default parameters specified by
  3179. SET-OPTIONS. For a description of USING and the parameters it takes, see EXPORT.
  3180.  
  3181. EXAMPLES
  3182. 1    IMPORT "aaa.exp"
  3183. 2    IMPORT "aaa.exp" TO FILE "aaa" WHERE(datefield) > DAYS("29 Apr 87")
  3184.  
  3185. INDEX
  3186. PURPOSE
  3187. Selects the index to be used with the current file.
  3188.  
  3189. SYNTAX
  3190. INDEX index
  3191.  
  3192. COMMENTS
  3193. Superbase automatically selects the first index as default when you open a file or when you make an open file the current file. With the INDEX command, you can select another of the file's indexes.
  3194. index is the name of a field in the current file. An index for this field must already exist.
  3195. Because DML parses entire lines before executing them, you cannot place an Index statement-or any other statement that refers to a field-on the same line as the OPEN FILE statement. When the DML interpreter reaches the INDEX statement, the file will not yet be open, and the field name, therefore, will not be recognized.
  3196. As a result, a line like
  3197.     OPEN FILE "aaa":INDEX anum
  3198. will produce an error message such as "Can't do this" or "Can't find this
  3199. field".
  3200.  
  3201. EXAMPLES
  3202. 1    OPEN FILE "aaa"
  3203.     INDEX anum
  3204. 2    OPEN FILE "aaa":OPEN FILE "bbb"
  3205.     .....
  3206.     .....
  3207.     FILE "aaa":INDEX anum
  3208.     .....
  3209.     FILE "bbb":INDEX datea
  3210.  
  3211. INPUT
  3212. PURPOSE
  3213. Reads characters or a line from a text file on disk into a variable or a field.
  3214.  
  3215. SYNTAX
  3216. INPUT[&nexp[, ]/LINE]var/field
  3217.  
  3218. COMMENTS
  3219. This statement inputs data from a text file on disk or from another computer
  3220. using the COMMS link. It assumes that an input channel has been opened for
  3221. example, by OPEN FOR INPUT.
  3222. With the LINE option, INPUT reads data from the input channel until it finds a line feed character(ASCII 10)and inputs the data into var or field. If the line feed character has been used as the record separator, INPUT LINE reads a record at a time.
  3223. var can be a string or numeric variable and field can be a text, numeric or date field. However, in each case the type of variable or field used should match the type of data expected. Thus if you attempt to input alphabetic characters into a numeric variable they will be valued at zero, while inputting them into a date field will produce an invalid date error.
  3224. &nexp specifies the number of characters that the command takes from the text
  3225. file. The comma after nexp is entirely optional.
  3226. When nexp is zero or when & nexp is not used, the command reads characters from the text file until it finds a comma (ASCII 44) or a line feed character (ASCII 10). This option allows INPUT to be used instead of IMPORT to read in data from an exported file.
  3227. To detect the end of a text file, use EOF("*").
  3228.  
  3229. EXAMPLES
  3230. 1    INPUT LINE a$
  3231. 2    INPUT &6a$(or INPUT &6, a$)
  3232. 3    INPUT a%
  3233. 4    FILE "aaa":EXPORT TO "aaa.exp"
  3234.     OPEN "aaa.exp" FOR INPUT
  3235.     FOR i%=1 TO RECCOUNT("aaa")
  3236.     BLANK
  3237.     INPUT field1
  3238.     INPUT field2
  3239.     ........
  3240.     INPUT lastfield
  3241.     STORE
  3242.     NEXT i%:CLOSE INPUT
  3243. Example 4 demonstrates how INPUT can be used as an alternative to IMPORT.
  3244.  
  3245. INSTR
  3246. PURPOSE
  3247. Returns the starting character position of a substring within a string, or
  3248. returns 0 if the substring is not contained within the string.
  3249.  
  3250. SYNTAX
  3251. INSTR[nexpr, ]strexpr, substrexpr)
  3252.  
  3253. COMMENTS
  3254. This function returns the position in strexpr of the first occurrence of
  3255. substrexpr. If nexpr is used, INSTR searches for the first occurrence of
  3256. substrexpr from position nexpr onwards. If the substring is not found, the value returned is zero.
  3257. nexpr must be positive and less than the length of strexpr. INSTR is case
  3258. sensitive, i.e., "abc" and "ABC" are different.
  3259.  
  3260. EXAMPLES
  3261. 1    x%=INSTR(x$, y$)
  3262. 2    x%=INSTR(textfield, "Mr")
  3263. 3    x%=INSTR(x$, "Mr"):y%=INSTR(x% + 1, x$, "Mr")
  3264. 4    ? LEFT$(textfield, INSTR(textfield, " ") -1)
  3265. 5    x$=LCASE$(textfield):x%=INSTR(x$, "abc")
  3266.     IF x% > 0 THEN ? LEFT$(textfield, x% -1)
  3267.  
  3268. NOTES
  3269. The second example simply locates the title 'Mr.'. Example 3 locates any 'Mr
  3270. and Mrs' or 'Mr & Mrs'. Example 4 displays the first word in textfield. Example 5 finds any occurrence of the sequence "abc" in textfield regardless of what case the letters are in.
  3271.  
  3272. INT
  3273. PURPOSE
  3274. Removes the part of a number to the right of the decimal point, turning it into a whole number.
  3275.  
  3276. SYNTAX
  3277. INT(nexpr)
  3278.  
  3279. COMMENTS
  3280. INT does not round a decimal number up or down to the nearest whole number, but simply strips off the decimal part. Thus INT(123.00001) and INT(123.999999) give the same result -123.0.
  3281.  
  3282. EXAMPLES
  3283. 1    numfieldc=INT(numfielda)
  3284. 2    numfieldc=INT(numfielda * (1 + numfield)/100
  3285. 3    $x=INT(VAL(RIGHT$(textfield, 2))/3.33
  3286. 4    $x=INT($y)
  3287. 5    ? INT($x ^ Sy)
  3288.  
  3289. KEY
  3290. PURPOSE
  3291. Displays the current set of function key definitions, or defines a new set.
  3292.  
  3293. SYNTAX
  3294. KEY keynum[, string]
  3295.  
  3296. COMMENTS
  3297. On the AMIGA and the Atari ST, 21 function keys are available:the keys F1 to
  3298. F10, which can be used with SHIFT, and the HELP key(HELP and Shift HELP are the same). Their numbers are:
  3299.     F1 to F10        1-10
  3300.     SHIFT(F1-F10)    11-20
  3301.     HELP            0
  3302. string can be any set of Superbase commands which can be entered on one
  3303. line(provided that they do not acceess a field on the same line as an OPEN
  3304. FILE). The command line in string is assigned to the key specified by keynum
  3305. Using KEY without a following command string clears the key associated with
  3306. keynum.
  3307. If keynum and string and not used, KEY displays the current set of function key definitions.
  3308.  
  3309. EXAMPLES
  3310. 1    KEY 1
  3311. 2    KEY 1, "OPEN FILE ~aaa~:BLANK:ENTER:STORE:? ~ Now 
  3312.     ~;RECCOUNT(~aaa~);~Records~"
  3313. 3    KEY
  3314. 4    KEY 3, "Tel. (0428) 725400 [(04203) 5601 evenings]"
  3315. Example 1 clears key F1. Example 2 sets F3 to enter a record into a file and
  3316. report how many records there now are. Note the use of the tilde character to
  3317. insert quotation marks. Since the entire string must be enclosed in quotation
  3318. marks, you cannot use quotation marks within the string.
  3319.  
  3320. LABELS
  3321. PURPOSE
  3322. Prints records as labels.
  3323.  
  3324. SYNTAX
  3325. LABELS [FILE sbfname] [WHERE conditions] [USING labelparams]
  3326.  
  3327. COMMENTS
  3328. This command is the program equivalent of selecting the Labels option from the PROCESS menu. It allows you print out records as labels and to define their format.
  3329. WHERE conditions limits the records for which labels are printed and acts as a filter.
  3330. USING allows you to specify the shape and content of the labels to be printed.
  3331. labelparams is a series of parameters separated by commas, relating to the label definition dialog. Reading down the left column of the dialog and then down the right column, they are as follows:
  3332.     line 1 fields/line
  3333.     line 2 fields/line
  3334.     line 3 fields/line
  3335.     line 4 fields/line
  3336.     line 5 fields/line
  3337.     line 6 fields/line
  3338.     line 7 fields/line
  3339.     line 8 fields/line
  3340.     line 9 fields/line
  3341.     line 10 fields/line
  3342.     First label margin
  3343.     label text width
  3344.     Second label margin
  3345.     First line next label
  3346.     Copies per label
  3347.     Labels per line
  3348. Note: All 16 parameters must be used.
  3349. If USING is not specified, LABELS takes the default parameters as shown in the label definition dialog(see Volume 1, Chapter 5).
  3350.  
  3351. EXAMPLES
  3352. 1    LABELS WHERE CITY="London"
  3353.     USING 1, 0, 2, 1, 1, 1, 1, 1, 0, 0, 1, 35, 40, 12, 1, 2
  3354. 2    LABELS "Address" WHERE Lastname LIKE "[a-c}*"
  3355.  
  3356. LCASE$
  3357. PURPOSE
  3358. Converts a text string to lowercase.
  3359.  
  3360. SYNTAX
  3361. LCASE$(strexpr)
  3362.  
  3363. COMMENTS
  3364. This function changes upper case letters to lower case;no other characters, 
  3365. including those already in lowercase, are affected.
  3366. The complementary function of LCASE$ is UCASE$.
  3367.  
  3368. EXAMPLES
  3369. 1    textfieldc=LCASE$(textfielda)
  3370. 2    x$=LCASE$(y$)
  3371. 3    x$=LCASE$("ABCDEF")
  3372. 4    ? LCASE$(x$)
  3373.  
  3374. LEFT$
  3375. PURPOSE
  3376. Extracts one or more characters from a string, starting at the left of the
  3377. string.
  3378.  
  3379. SYNTAX
  3380. LEFT$(strexpr, nexpr)
  3381.  
  3382.                 5-78
  3383.  
  3384. COMMENTS
  3385. LEFT$ returns the leftmost nexpr characters of the string strexpr. Thus, if
  3386. strexpr is DICTIONARY and expr is 7:
  3387.     LEFT$("DIRECTIONARY", 7)
  3388. returns DICTION.
  3389.  
  3390. EXAMPLES
  3391. 1    textfieldc=LEFT$(textfielda, 10)
  3392. 2    textfieldc=UCASE$(LEFT$(textfielda, 1))
  3393.     + MID$(testfielda, 2)
  3394. 3    LEFT$(textfielda, 1)LIKE [a-c]
  3395. 4    x$=LEFT$("ABCD", 2)
  3396. 5    x$=LEFT$(x$, n$)
  3397. 6    ? LEFT$(x$, 10)
  3398. 7    strip:IF LEFT$(x$, 1)=" " THEN x$=MID$(x$, 2):GOTO strip
  3399.  
  3400. NOTES
  3401. Example 7 is a one line program to strip leading spaces from x$(see LTRIM$).
  3402.  
  3403. LEN
  3404. PURPOSE
  3405. Returns the number of characters in a text string or text field.
  3406.  
  3407. SYNTAX
  3408. LEN(strexpr)
  3409.  
  3410. COMMENTS
  3411. LEN counts the number of characters in a string, including spaces and non-
  3412. printing characters.
  3413.  
  3414. EXAMPLES
  3415. 1    numfieldc=LEN(textfielda)
  3416. 2    textfieldc=RIGHT$(textfielda, LEN(testfieldb)
  3417. 3    LEN(textfielda) > 25 AND LEN(textfielda) 50
  3418. 4    x$=LEN("A")
  3419. 5    x$=LEN(x$)
  3420. 6    x$=LEN(MID$(extfield, 3))
  3421. 7    ? LEN(x$)
  3422.  
  3423. LET
  3424. PURPOSE
  3425. Assign a value to a variable.
  3426.  
  3427. SYNTAX
  3428. [LET] var/field=expr/[expr1 ? expra:exprb]
  3429.  
  3430. COMMENTS
  3431. The keyword LET is optional and is usually omitted. In other words, to assign a value to a variable or a field, you only need to use the equal sign.
  3432. The LET option has been included in DML to maintain compatibility with earlier versions of Basic. DML also provides a more unusual facility when you use the syntax:
  3433.  
  3434. var/field=expr1 ? expra:exprab
  3435.  
  3436. This option provides a short way of assigning different values to a variable or field, depending on whether an expression is true or not;that is, it makes
  3437. assignment conditional on the truth or falsity of a specified expression. If
  3438. expr1 is true, expra is assigned to the variable or field;if it is false, exprb is assigned. It is equivalent to
  3439.     IF expr1
  3440.     THEN var/field=expra
  3441.     ELSE var/field=exprab
  3442. Used in this way, the question mark character is referred to as a 'ternary
  3443. operator' to reflect the fact that three operands are required at the right of the equal sign. In fact, you can chain ternary operators together to create a statement which contains multiple conditions and assigns one of multiple values.
  3444. Within a program, however, you will generally find it easier to use the IF THEN ELSE statement. The main application for the ternary operator is in a Superbase file definition. Here it has an important advantage over the IF THEN ELSE statement: it can be entered as a calculation formula for a field in a file definition.
  3445. For a fuller discussion of the ternary operator and its applications, see
  3446. Chapter 2, Volume 1.
  3447.  
  3448. EXAMPLES
  3449. 1    item$="Sprocket"
  3450. 2    Textfielda="London"
  3451. 3    b%=3.25
  3452. 4    numfieldb=INT(277/62)
  3453. The following examples assume that x$="ABC" and x%=4.5
  3454. 5    y$=(x$="ABC") ? "yes":"no"
  3455. This example assigns "yes" to y$.
  3456. 6    y$=(x$="aaa") ? x$:""
  3457. Assigns "" to y$.
  3458. 7    y$=(x% > 3.5) ? "yes": "no"
  3459. Assigns "yes" to y$
  3460. 8    y$=EOF ("INPUT") ? "end of file": "more to read"
  3461.  
  3462. LIST
  3463. PURPOSE
  3464. Lists a text file to the screen.
  3465.  
  3466. SYNTAX
  3467. LIST filename
  3468.  
  3469. COMMENTS
  3470. LIST is the program equivalent of the LIST option in the SYSTEM menu. It
  3471. displays a text file on the screen.
  3472. Do not confuse LIST with ? LIST, which displays a program listing. LIST only
  3473. works with text files. Note also that unlike many other DML commands, LIST
  3474. requires the file name itself plus its extension name.
  3475.  
  3476. EXAMPLES
  3477. 1    LIST "aaa.exp"
  3478. 2    LIST "Address.sbd"
  3479.  
  3480. LOAD
  3481. PURPOSE
  3482. Loads any of the following types of file into memory:programs, text files, 
  3483. function key files, Query and Update files.
  3484.  
  3485. SYNTAX
  3486. LOAD [TEXT]/[KEY]/[QUERY]/[UPDATE]filename[, APPEND]
  3487.  
  3488. COMMENTS
  3489. If none of the options TEXT, KEY, QUERY or UPDATE is used, Superbase assumes that filename refers to a '.sbp' file and attempts to load a PROGRAM file.
  3490. The APPEND option can be used with program files and text files to append a
  3491. file on disk to the file in memory.
  3492. Note that LOAD cannot be used to load a Superbase data file(a file with an
  3493. '.sbf' extension). For this you need to use the OPEN FILE command.
  3494.  
  3495. EXAMPLES
  3496. 1    LOAD "Program1"
  3497. 2    LOAD TEXT "Banklet"
  3498. 3    LOAD QUERY "Deptran"
  3499. 4    LOAD KEY "Funkey1"
  3500. 5    LOAD TEXT "Document2", APPEND
  3501.  
  3502. LOCATE
  3503. PURPOSE
  3504. Sets the position at which the next output appears on the current output
  3505. device(generally, the screen or the printer).
  3506.  
  3507. SYNTAX
  3508. LOCATE column[, row]
  3509.  
  3510. COMMENTS
  3511. When you are displaying something on the screen, LOCATE allows you to specify
  3512. where it appears.
  3513. column and row must be numeric expressions.row is optional and if it is not
  3514. included, LOCATE moves the cursor to the specified column position on the
  3515. current line.
  3516. You cannot use LOCATE to move the cursor backwards or up the screen:it will not move the cursor to a position on the same line which is to the left of the current position;and it will not move the cursor to a line above the current position. However, you can bypass this restriction if you place the HOME
  3517. statement in front of LOCATE-see HOME.
  3518.  
  3519. EXAMPLES
  3520. 1    LOCATE 12, 5:? "Hello"
  3521. 2    c%=12:r%=1:LOCATE c%, r%
  3522. 3    LOCATE 12:? "Hello"
  3523.  
  3524. NOTES
  3525. The first example displays the word 'hello' at the 12th column on the sixth
  3526. row. Example 3 displays 'hello' at the 12th column of whatever line the cursor happens to be on.
  3527.  
  3528. LOG
  3529. PURPOSE
  3530. Returns the natural logarithm(log to the base 'e')of a number.
  3531.  
  3532. SYNTAX
  3533. LOG(nexpr)
  3534.  
  3535. COMMENTS
  3536. The value of nexpr must be positive. Negative numbers or zero produce the error message 'Invalid numeric parameter'.
  3537.  
  3538. EXAMPLES
  3539. 1    numfieldc=LOG(numfielda)
  3540. 2    numfieldc=LOG(datefielda-datefieldb)
  3541. 3    numfieldc > LOG(numfielda * numfieldb)
  3542. 4    x%=LOG(y%)
  3543. 5    x%=LOG(y% * numfielda * (datefielda-datefieldb))
  3544.  
  3545. LOOKUP
  3546. PURPOSE
  3547. Detects whether an expression occurs in a file in a specified field.
  3548.  
  3549. SYNTAX
  3550. LOOKUP(expr, field.file)
  3551.  
  3552. COMMENTS
  3553. This function checks whether a given field in a file contains the expression in expr. That is, it answers the question:does expr exist in field.file? If it finds the expression, LOOKUP returns the value -1(true);otherwise it returns the value 0 (false).
  3554. expr and field.file must be of the same type(i.e. text or numeric). field.file must be the name of an indexed field in an open file.
  3555. LOOKUP plays a major role in cross-file validation and calculation. The file
  3556. specified with LOOKUP can be any open file;so you can use this function to
  3557. perform a relational lookup, where it checks whether the contents of a field in one file match the contents of a field in another file.
  3558. If LOOKUP is successful-if it finds the expression you have specified-the
  3559. record containing the expression becomes the current record, even though the
  3560. file may not be the current file and is not displayed on screen. At the same
  3561. time, the FOUND function is set to -1 to reflect the fact that the search has
  3562. been successful.
  3563. For a fuller explanation of LOOKUP, see Chapter 2, Volume 1.
  3564.  
  3565. EXAMPLES
  3566. 1    OPEN FILE "aaa":OPEN FILE "bbb"
  3567.     SELECT FIRST
  3568.     WHILE NOT EOF("bbb")
  3569.     IF LOOKUP(field1.bbb, field1.aaa)THEN GOSUB Process_module
  3570.     WEND
  3571.     ? "Process completed":END
  3572.     Process_module:
  3573.     ......
  3574.     ......
  3575.     RETURN
  3576.  
  3577. This example demonstrates a small program to process only those records in file 'bbb' that have a matching record in file 'aaa'. File 'bbb' could be an invoice file 'joined' to a customer file 'aaa' by a customer code(field1 in 'bbb' and 'aaa').
  3578.  
  3579. LTRIM$
  3580. PURPOSE
  3581. Trims leading spaces from a text expression or a text field.
  3582.  
  3583. SYNTAX
  3584. LTRIM$(strexpr)
  3585.  
  3586. COMMENTS
  3587. LTRIM$ returns a string consisting of the original string specified by strexpr with any leading spaces removed.
  3588.  
  3589. EXAMPLES
  3590. 1    textfieldc=LTRIM$(textfielda)
  3591. 2    x$=LTRIM$(textfieldc.filea)
  3592. 3    ? LEN(x$);LEN(LTRIM$(x$))
  3593.  
  3594. MAKE
  3595. PURPOSE
  3596. Stores the file definition for a file it has been defined by CREATE and ADD.
  3597.  
  3598. SYNTAX
  3599. MAKE sbfname
  3600.  
  3601. COMMENTS
  3602. This command is used as the last step in the process of creating a new file.
  3603. After the file has been defined by CREATE and ADD, MAKE writes the new file
  3604. definition to disk together with any indexes that have created.
  3605. Note that a file definition is not regarded as valid until the MAKE command has been executed. Before then, any error will have the effect of removing the file definition.
  3606.  
  3607. EXAMPLES
  3608. 1    CREATE "Address"
  3609.     ADD "Firstname;TXT REQ;20;1, 2"
  3610.     ADD "Lastname;TXT REQ IXD;20;1, 33"
  3611.     ADD "Street";TXT;25;3, 2"
  3612.     (other field definitions)
  3613.     ........
  3614.     ........
  3615.     MAKE "Address"
  3616.  
  3617. MENU
  3618. PURPOSE
  3619. Sets up a user-define menu
  3620.  
  3621. SYNTAX
  3622. MENU column, item, state[, strexpr]
  3623.  
  3624. COMMENTS
  3625. Superbase let you define up to 10 menu each of which can have a maximum of 12
  3626. items. With the Menu command you supply the text for a single item and specify whether it will appear on the menu an enabled, disabled(ghosted)or with a check mark against it. Having defined a menu with a series of MENU commands-one for each menu item and one for the menu title-you can then use the MENU ON command to turn the menu(or menus)on. You also use MENU to specify a numeric variable which will return a value showing which item, if any, has been selected.
  3627. column must be a numeric expression with a value in the range 1 to 10 giving
  3628. the column number for the menu. To set up a menu in the first column on the
  3629. left at the same position as the Superbase Project menu, you would enter a value of one.
  3630. item must be a numeric expression with a value in the range 0 to 12, giving the number of the menu item. Item 0 is the menu heading, the text that appears on the menu bar.
  3631. state can take a value of 0, 1 or 2.0 disables the item so that it appears on
  3632. the menu as a ghosted option.1 enables it, 2 places a check mark against it.
  3633. strexpr supplies the text for the item. For example, if you wished to define a menu in the first column which contained the option Deposits, you could enter:
  3634.     MENU 1, 3, 1, "Deposits"
  3635. This would make Deposits the third item in the menu list. To disable the
  3636. Deposits option, you would enter:
  3637.     MENU 1, 3, 0
  3638. Note that you do not need to specify the text a second time.
  3639.  
  3640. EXAMPLES
  3641. 1    MENU 1, 0, 1, "Transactions"
  3642.     MENU 1, 1, 1, "Deposits"
  3643.     MENU 1, 2, 1, "Withdrawal"
  3644.     MENU 1, 3, 1, "Direct debit"
  3645.     MENU 1, 4, 1, "Standing orders"
  3646.     MENU 1, 5, 1, "Credit card"
  3647.     MENU ON a%, b%
  3648.  
  3649. NOTES
  3650. This example defines a menu in the first column with five options(items), all of them enabled.(The heading for the menu is Transactions.) MENU ON then turns the menu on. When the user selects an item, Superbase will place its column and item numbers in the variables a% and b%.
  3651.  
  3652. MENU CLEAR
  3653. PURPOSE
  3654. Turns off all user-defined menus and clears their definitions from memory.
  3655.  
  3656. SYNTAX
  3657. MEMORY CLEAR
  3658.  
  3659. COMMENTS
  3660. If you want to define a new set of menus, you can use this command to clear any menus which have been defined previously. You may also use it when your menus are no longer required, in order to make the memory space they occupy available for other purposes.
  3661.  
  3662. MENU ON
  3663. PURPOSE
  3664. Turns user-defined menus on and specifies the variables which return the result of a menu selection.
  3665.  
  3666. SYNTAX
  3667. MENU ON nvar1, nvar2
  3668.  
  3669. COMMENTS
  3670. MENU ON turns on any menus which have been defined with the MENU command and
  3671. sets nvar1 and nvar2 to zero.
  3672. When the user selects an item, Superbase places the column number in nvar1 and places the item number in nvar2. It also turns all the user-defined menus off.
  3673. For example, if the second item in the third user-defined menu has been
  3674. selected, the first numeric variable specified with MENU ON, will contain the
  3675. value 3 and the second numeric variable will contain the value 2.
  3676. You may sometimes want to turn the menus off without waiting for an item to be selected. You can do this with the command MENU OFF.
  3677.  
  3678. EXAMPLES
  3679. 1    menuloop:
  3680.     MENU ON a%, b%
  3681.     ON a% GOSUB sub1, sub2, sub3, sub4, sub5
  3682.     GOTO menuloop
  3683.  
  3684. NOTES
  3685. This examples presumes that five menus have been defined and that sub1 to sub5 are subroutines which handle item selection for each menu.
  3686.  
  3687. MERGE
  3688. PURPOSE
  3689. Loads a text file and performs a mail merge.
  3690.  
  3691. SYNTAX
  3692. MERGE [TEXT filename] [WHERE conditions]
  3693.  
  3694. COMMENTS
  3695. This command merges the data in an '.sbf' file with a form letter in the Text
  3696. Editor and outputs the results to the printer. It takes data from the current
  3697. open file and-if WHERE is not included-prints one letter for each record in the file. You can use WHERE to set up a filter restricting the merge operation to only those records which match the conditions specified. The TEXT option lets you specify a text file on disk; Superbase will then load the file into the Text Editor before starting the merge operation.
  3698. Although Merge is the program equivalent of the Mail Merge option on the
  3699. Process menu, it does not allow you to preview letters on screen before printing them. To do this, use ? TEXT with the MERGE parameter.
  3700.  
  3701. EXAMPLES
  3702. 1    OPEN FILE "Address"
  3703.     MERGE TEXT "Mailshot1" WHERE Country LIKE "USA"
  3704.  
  3705. MID$
  3706. PURPOSE
  3707. Returns one or more characters from within a text string or text field.
  3708.  
  3709. SYNTAX
  3710. MID$(strexpr, nexpr1[, nexpr2])
  3711.  
  3712. COMMENTS
  3713. MID$ is more flexible than LEFT$ and RIGHT$ as it can extract characters from
  3714. any point in a string.strexpr holds the string, and nexpr1 gives the starting
  3715. point in the string.nexpr2 specifies the length of the substring to be
  3716. extracted; if nexpr2 is not given, MID$ takes all the characters from the
  3717. starting point to the end.
  3718.  
  3719. EXAMPLES
  3720. 1    textfieldc=MID$(textfielda, 10, 10)
  3721. 2    textfieldc=LCASE$(MID$(textfielda, 8))
  3722. 3    MID$(textfielda, 12, 1)LIKE[a-c]
  3723. 4    x$-MID$(textfieldc, 19, 2)
  3724. 5    x$=(x$, 4)
  3725. 6    ? MID$(x$, 4, 2)
  3726. 7    ASK;A$:
  3727.     I%=LEN(A$)
  3728.     FOR n%=I% TO 1 STEP -1
  3729.     B$=B$ + MID$(A$, n%, 1)
  3730.     NEXT
  3731.     ? B$
  3732.  
  3733. NOTES
  3734. Example 7 inputs a word into A$ and turns it back to front.
  3735.  
  3736. MINS
  3737. PURPOSE
  3738. Extracts the number of minutes from a numeric value which holds the time in
  3739. thousandths of a second.
  3740.  
  3741. SYNTAX
  3742. MINS(nexpr)
  3743.  
  3744. COMMENTS
  3745. Usually, nexpr will be a timefield or the result of a TIMEVAL calculation.
  3746.  
  3747. EXAMPLES
  3748. 1    mnts%=MINS(timefield)
  3749. 2    ? MINS(NOW - start%);"minutes have elapsed"
  3750.  
  3751. MOD
  3752. PURPOSE
  3753. Gives the remainder of a numeric expression after it has been divided.
  3754.  
  3755. SYNTAX
  3756. nexpr1 MOD nexpr2
  3757.  
  3758. COMMENTS
  3759. nexpr1 is the number to be divided, nexpr2 is the number that divides into it
  3760. (the divisor). MOD returns the remainder when nexpr1 has been divided by
  3761. nexpr2. For example:
  3762.     14 MOD 3
  3763. gives 2 as a result. It is equivalent to:
  3764.     14-INT(14/3) * 3
  3765.  
  3766. EXAMPLES
  3767. 1    ?(2.53 * 100) MOD 100
  3768.  
  3769. NOTES
  3770. The example line strips off the integer part of a number and displays the first two figures after the decimal place.
  3771.  
  3772. MODIFY
  3773. PURPOSE
  3774. Modifies a field definition.
  3775.  
  3776. SYNTAX
  3777. MODIFY field[, ] [field definition string] [, formula] [, formula]
  3778.  
  3779. COMMENTS
  3780. MODIFY is the program equivalent of the EDIT FILE option in PROJECT. It allows you to alter a field's parameters;for example, the field name or its length.
  3781. The field definition and formula strings take the same form as they do with the ADD command.
  3782.  
  3783. EXAMPLES
  3784. 1    MODIFY Forename "Firstname;TXT REQ IXU;15 U;1, 12"
  3785.  
  3786. MONTH$
  3787. PURPOSE
  3788. Takes a julian date number and returns the month of the year as a text string.
  3789.  
  3790. SYNTAX
  3791. MONTH$(nexpr)
  3792.  
  3793. COMMENTS
  3794. The same limitations on which julian dates are acceptable apply to this
  3795. function as they do to other date functions.
  3796. The format of the text string is the full month name regardless of what current date format is - i.e., January, not Jan).
  3797. Associated date functions are DAY DAYS DAY$ MONTH MONTH$ YEAR.
  3798.  
  3799. EXAMPLES
  3800. 1    textfieldc=MONTHS$(datefielda)
  3801. 2    textfieldc=MONTH$(datefielda + 90)
  3802. 3    textfieldc=MONTH$(TODAY)
  3803. 4    x$=MONTH$(datefielda + VAL(textfielda))
  3804. 5    x$=MONTH$(DAYS ("11 Jan 85")
  3805. 6    ? MONTH$(datefielda + 30)
  3806.  
  3807. NEW
  3808. PURPOSE
  3809. Clears the program area or text area.
  3810.  
  3811. SYNTAX
  3812. NEW [TEXT/QUERY/UPDATE]
  3813.  
  3814. COMMENTS
  3815. On its own, NEW erases any program that is currently in the computer's memory.
  3816. When followed by TEXT, it clears the current text editor area of memory.
  3817. Following it by or QUERY or UPDATE, clears their respective dialogs.
  3818. Unlike the menu options Program New(and Text New)this command does not put you into the program(or text)editor.
  3819.  
  3820. NEWLINE
  3821. PURPOSE
  3822. Sends a new line character(or characters)to an output device.
  3823.  
  3824. SYNTAX
  3825. NEWLINE[nexp]
  3826.  
  3827. COMMENTS
  3828. This command prints a new line at the current output device;i.e. with the
  3829. screen display, it takes the cursor onto the start of the next line.nexp can be used to specify more than one new line.
  3830. If nexp is not an integer, only the integer part will be taken.
  3831.  
  3832. EXAMPLES
  3833. 1    NEWLINE 2
  3834. 2    FOR i%=1 to 20
  3835.     ? i%:if i% MOD 5=0 THEN NEWLINE i%/5
  3836.     NEXT i%
  3837.  
  3838. NOTES
  3839. Example 2 outputs the numbers 1 to 5 with single line spacing, 6 to 10 with
  3840. double spacing, and so on up to 20.
  3841.  
  3842. NOW
  3843. PURPOSE
  3844. Gives the system time.
  3845.  
  3846. SYNTAX
  3847. NOW
  3848.  
  3849. COMMENTS
  3850. NOW shows the time of day in hours and minutes, using the current time format.
  3851. If you have a real-time clock in your computer or you have set the system time, this will be the current time.
  3852. Note that NOW actually holds the time in thousandths of a second. When you
  3853. display the time, Superbase automatically translates it into hours and minutes.
  3854.  
  3855. EXAMPLES
  3856. 1    ? NOW
  3857. 2    ? MINS(NOW)
  3858. 3    timefield=NOW
  3859.  
  3860. NUMBASE
  3861. PURPOSE
  3862. Sets the numeric format in which numbers are displayed.
  3863.  
  3864. SYNTAX
  3865. NUMBASE string
  3866.  
  3867. COMMENTS
  3868. NUMBASE is the program equivalent of the Number Format option in the SET menu.
  3869. string must be one of Superbase's valid numeric formats, as listed Chapter 2, 
  3870. Volume 1. For example, "z99999.00" or "z(+$, 000000.00".
  3871.  
  3872. EXAMPLES
  3873. 1    NUMBASE "z99999."
  3874. Integer only format.
  3875. 2    NUMBASE "+*****.00"
  3876. Numbers displayed with a sign and leading cheque-protect.
  3877.  
  3878. ON ERROR
  3879. PURPOSE
  3880. Tells DML to branch to another part of the program when an error occurs.
  3881.  
  3882. SYNTAX 
  3883. ON ERROR [[GOTO]label]
  3884.  
  3885. COMMENTS
  3886. Normally, DML halts program execution and displays an error message when it
  3887. detects an error. ON ERROR enables error trapping, and prevents the program from halting. Once an error has been detected, it causes the program to jump to the error handling routine specified with label.
  3888. You can use ERRNO in your error handling routine to check on which error has
  3889. occurred, and take appropriate action. In many cases, you will want the program to resume execution after detecting an error. You can do this with the RESUME statement.
  3890.  
  3891. To disable error trapping, use ON ERROR without a following label.
  3892.  
  3893. EXAMPLES
  3894. 1    ON ERROR GOTO check
  3895.     ......
  3896.     ......
  3897.     ......
  3898.     check:IF ERRNO 11 THEN
  3899.     RESUME
  3900.     ELSE? "Are you sure you want to exit from this program?"
  3901.     ? "Press Y to exit, any another key to resume"
  3902.     WAIT a$
  3903.     IF a$="Y" OR a$="y" THEN END ELSE RESUME
  3904.     ENDIF
  3905.  
  3906. NOTES
  3907. In this example, ON ERROR is used to check whether the Stop button has been
  3908. clicked on or CTRL C has been pressed. Both these events generate error number 11, so the error handling routine(which starts at label 'check')first tests for this error number. If it finds that another error event has occurred, program execution is resumed at the line which caused the error. The error handling routine then asks if the user wishes to exit or not. Depending on the answer it receives, it either resumes execution at the line which caused the error (the line being executed when the user pressed STOP or CTRL C)or terminates the program.
  3909.  
  3910. ON GOSUB
  3911. PURPOSE
  3912. Calls one of a number of subroutines from a list of subroutines.
  3913.  
  3914. SYNTAX
  3915. ON nexp GOSUB label1 [, label2, label3, ...]
  3916.  
  3917. COMMENTS
  3918. This statement transfers program control to one of the subroutines given in the list. The value of nexp determines which subroutine the program jumps to. If nexp has valued at 1 the program branches to the subroutine at the first label, if nexp has a value of 2, it branches to the subroutine at the second label, and so on.
  3919. Once the program has branched to a subroutine, it executes each statement in
  3920. turn until it meets a RETURN statement. Then it jumps back to the line
  3921. following the ON GOSUB statement.
  3922. Any label can be repeated.
  3923. If nexp is 0 or greater than the number of supplied labels, program control
  3924. drops to the next statement after the ON GOSUB statement.
  3925.  
  3926. EXAMPLES
  3927. 1    ON x% GOSUB lab1, lab2, lab3
  3928. 2    ON x% GOSUB lab1, lab2, lab1, lab2, lab1
  3929.  
  3930. ON GOTO
  3931. PURPOSE
  3932. Branches to one of a list of labels.
  3933.  
  3934. SYNTAX
  3935. ON nexp GOTO label [, label, ....]
  3936.  
  3937. COMMENTS
  3938. This command transfers program control to one of the program lines given in the list. The value of nexp determines which label the program jumps to.
  3939. If nexp has valued at 1 the program branches to the first label, if nexp has a value of 2, it branches to the second label, and so on. For a general description of GOTO refer to GOTO itself.
  3940. nexp should be a positive integer. If it is not an integer, the whole number
  3941. part will be taken.
  3942. Any label can be repeated.
  3943. If nexp is 0 or greater than the number of supplied labels, program control
  3944. drops to the next statement after ON GOTO.
  3945.  
  3946. EXAMPLES
  3947. 1    ON x% GOTO lab1, lab2, lab3
  3948. 2    ON x% GOTO lab1, lab2, lab1, lab2, lab1
  3949.     ? "Reached here only when x% is 0 or greater than 5
  3950.  
  3951. OPEN
  3952. PURPOSE
  3953. Opens a text file on disk or Comms channel for input/output.
  3954.  
  3955. SYNTAX
  3956. OPEN filename FOR[INPUT/OUTPUT/APPEND]
  3957.  
  3958. COMMENTS
  3959. When used for output to a file, OPEN has the same effect as OUTPUT TO file.
  3960. There is only one channel for INPUT, and one for OUTPUT, so you cannot have two output channels, or two input channels. However, you can have one of each open at the same time.
  3961. APPEND is an output channel and specifies that file is to be appended to. You
  3962. must not try to specify OPEN "aaa" FOR OUTPUT APPEND.
  3963. If using OPEN, file is overwritten without warning.
  3964. If using APPEND, file need not exist.
  3965. If using INPUT, file must exist.
  3966.  
  3967. EXAMPLES
  3968. 1    OPEN "aaa" FOR OUTPUT
  3969. 2    OPEN "aaa" FOR APPEND
  3970. 3    OPEN "bbb" FOR INPUT:OPEN "aaa" APPEND
  3971.     lab1:INPUT LINE a$:? a$
  3972.     IF NOT EOF ("*")THEN GOTO lab1
  3973.     CLOSE INPUT:CLOSE OUTPUT
  3974.  
  3975. NOTES
  3976. Example 3 appends the contents of file 'bbb' to file 'aaa'. Notice that the
  3977. last line of the program CLOSEs the files that OPEN has opened. This practise
  3978. is strongly recommended:you should always close a file when you have finished
  3979. writing to it.
  3980.  
  3981. OPEN FORM
  3982. PURPOSE
  3983. Loads a form from disk and displays it in the database window.
  3984.  
  3985. SYNTAX
  3986. OPEN FORM form
  3987.  
  3988. COMMENTS
  3989. form must be a string expression giving the file name of a form. Superbase will also open any database files associated with the form.
  3990.  
  3991. EXAMPLES
  3992. 1    OPEN FORM "Invoice"
  3993.  
  3994. OPEN FIELDS
  3995. PURPOSE
  3996. Specifies which fields are displayed.
  3997.  
  3998. SYNTAX
  3999. OPEN FIELDS [FILE sbfname] fieldlist
  4000. COMMENTS
  4001. This command is the program equivalent of the Open Fields option on the Project Menu. fieldlist consists of the list of fields required to be open. To remove any restrictions on which fields are shown, use the CLOSE FIELDS command.
  4002.  
  4003. EXAMPLES
  4004. 1    OPEN FIELDS FILE "Address" Firstname, Lastname, Country, City
  4005.  
  4006. OPEN FILE
  4007. PURPOSE
  4008. Opens a database file and its default index.
  4009.  
  4010. SYNTAX
  4011. OPEN FILE sbfname [;password]
  4012.  
  4013. COMMENTS
  4014. Note the distinction between OPEN FILE "aaa" which opens a database file, and
  4015. OPEN "aaa"(FOR INPUT)which opens a text file.
  4016. sbfname is compulsory, and if a password is required to access the file, then it is also compulsory (use a semicolon to separate the filename from the password).
  4017. INDEX followed by a field name may be added to the end of an OPEN FILE command, allowing you to select an index other than the default index. But it can only be used if the file has already been opened by a direct command or an earlier program line. As explained in the entry for the INDEX command, DML parses the whole line before executing it;so if you refer to a field, it must be a field in a file that already been opened. Otherwise an error will result.
  4018.  
  4019. EXAMPLES
  4020. 1    OPEN FILE "aaa"
  4021. 2    x$="bbb":OPEN FILE x$
  4022. 3     OPEN FILE "aaa";"John"
  4023.  
  4024. NOTES
  4025. In example 3, 'John' is the password for the file 'aaa'.
  4026.  
  4027. ORDER
  4028. PURPOSE
  4029. Sets the order for Query output.
  4030.  
  4031. SYNTAX
  4032. ORDER [&nexpr]field[ASCENDING/DESCENDING] [, field]
  4033.                 ASCENDING/DESCENDING] [, .....]
  4034.  
  4035. COMMENTS
  4036. ORDER is a Query Language command and can only be entered in a query section -i.e., it works in conjunction with the Query Language command Select.
  4037. This command is the program equivalent of the Order command line in the query
  4038. definition dialog: it takes the same syntax and serves the same purpose. The
  4039. field specified with the ORDER command determines the order in which the field in the SELECT line are output. If you are familiar with the concept of sorting, you can think of ORDER as setting the sort 'key' for query output.
  4040. field must be a field in an open file, but it does not need to be an indexed
  4041. field; nor does it have to be one of the fields in the SELECT line.
  4042. ASCENDING and DESCENDING allow you to specify whether data is sorted in
  4043. ascending or descending order. If you specify a text field with the ORDER
  4044. command - i.e., if you specify it as the sort key-Supervase outputs record data according to the alphabetical order of the sort field. DESCENDING reverses the order and sorts the field from Z to A.
  4045. With numeric, date and time fields, ASCENDING sorts data in numeric, date or time order; and DESCENDING reverses the order.
  4046. By default, fields are sorted in ascending order;so it not strickly necessary to include the ASCENDING parameter.
  4047. You can also specify more than one field in the ORDER line, separating each with a comma. If enter two fields, the first field takes precedence as a sort key over the second field; i.e., records are first sorted according to the first field, and then any duplicate data items are sorted according to the second key.
  4048. The same applies if there are more than two fields:the second key has priority over the third, the third has over the fourth, and so on.
  4049.  
  4050. EXAMPLES
  4051. The examples illustrate how ORDER works by taking a limited set of records and showing some of the different ways in which they may be sorted. Each record contains data from three fields, Firstname, Lastname, and Country.
  4052.  
  4053. 1    SELECT Firstname, Lastname, Country
  4054.     ORDER Lastname
  4055. This examples takes Lastname as the sort key and produces the following output:
  4056.  
  4057. FIRSTNAME        LASTNAME        COUNTRY
  4058. Pierre        Arnauld            France
  4059. William        Carter            USA
  4060. Gerde        Hemrich            West Germany
  4061. John            Miles            England
  4062. Anne            Richardson        USA
  4063. Peter        Smith            England
  4064. Robert        Brown            England
  4065.  
  4066. 2    SELECT Firstname, Lastname, Country
  4067.     ORDER Country
  4068. The output from this query would be as follows:
  4069.  
  4070. FIRSTNAME        LASTNAME        COUNTRY
  4071. Robert        Brown            England
  4072. John            Miles            England
  4073. Peter        Smith            England
  4074. Pierre        Arnauld            France
  4075. William        Carter            USA
  4076. Anne            Richardson        USA
  4077. Gerde        Hemrich            West Germany
  4078.  
  4079.                 5-107
  4080.  
  4081. 3    SELECT Firstname, Lastname
  4082.     ORDER Country DESCENDING, Lastname ASCENDING
  4083. The output from this query is:
  4084.  
  4085. FIRSTNAME        LASTNAME
  4086. Gerde        Hemrich
  4087. William        Carter
  4088. Anne            Richardson
  4089. Pierre        Arnauld
  4090. Robert        Brown
  4091. John            Miles
  4092. Peter        Smith
  4093.  
  4094. 4    SELECT Firstname, Lastname, Country
  4095.     ORDER Country, Firstname
  4096. This example uses Country as the primary sort key and Firstname as the
  4097. secondary key to produce the following output:
  4098.  
  4099. FIRSTNAME        LASTNAME        COUNTRY
  4100. John            Miles            England
  4101. Peter        Smith            England
  4102. Robert        Brown            England
  4103. Pierre        Arnauld            France
  4104. Anne            Richardson        USA
  4105. William        Carter            USA
  4106. Gerde        Hemrich            West Germany
  4107.  
  4108. NOTES
  4109. The default length for sorting is 15 characters per field. Superbase gives
  4110. equal weighting to upper case, lower case and accented instances of characters.
  4111. The & character followed by a value up to the length of the field may precede
  4112. any field, specifying the number of characters that will be used in sorting.
  4113.  
  4114. OUTPUT TO
  4115. PURPOSE
  4116. Opens a text file on disk for output.
  4117.  
  4118. SYNTAX
  4119. OUTPUT TO filename
  4120.  
  4121. COMMENTS
  4122. This command makes the disk the current output device and sends any future
  4123. output to filename. It has the same effect as OPEN filename FOR OUTPUT.
  4124. If the text file already exists on disk, any output command issued after OUTPUT TO, will overwrite the file. If you want to add data to an existing text file, use OPEN filename FOR APPEND.
  4125.  
  4126. EXAMPLES
  4127. 1    OUTPUT TO "Names"
  4128.     ? Lastname
  4129.     CLOSE OUTPUT
  4130. 2    OUTPUT TO a$
  4131.  
  4132. NOTES Example 1 stores the contents of the Lastname field(in the current
  4133. record)on disk in the text file Names.
  4134.  
  4135. PASSWORD
  4136. PURPOSE
  4137. Sets new password(or none)for a specified file.
  4138.  
  4139. SYNTAX
  4140. PASSWORD sbfname [;passwords]
  4141.  
  4142. COMMENTS
  4143. sbfname must be an open file and, as usual with filenames, must be included in quotation marks.
  4144. If no password is given, the existing password for the specified file is
  4145. removed.
  4146.  
  4147. EXAMPLES
  4148. 1    OPEN FILE "aaa;John"
  4149.     PASSWORD "aaa"
  4150. Removes passwords.
  4151. 2    PASSWORD "aaa;Rosebud"
  4152. Sets a password for the file 'aaa'.
  4153. 3    OPEN FILE "aaa;John"
  4154.     PASSWORD "aaa;John;Paul;George"
  4155. Adds passwords for read/write and read only access privileges.
  4156.  
  4157. PCOL
  4158. PURPOSE
  4159. Return the column position of the print head on the current output printer or
  4160. resets the print head's position.
  4161.  
  4162. SYNTAX
  4163. PCOL(nexpr)
  4164.  
  4165. COMMENTS
  4166. If nexpr is zero, the function returns the column position of the print head
  4167. on the current printer. For the Row position, see PROW. See also LOCATE.
  4168. You can also use this function to set the counter Superbase uses to keep track of the print head's position. Giving nexpr a positive value, sets the counter to that value. The print head itself is not moved. This feature is used to reset the internal count after issuing a series of printer commands which have not in fact moved the print head, for example, after switching to high density graphics mode.
  4169.  
  4170. EXAMPLES
  4171. 1    x%=PCOL(0)
  4172. 2    ? PCOL(0)
  4173.  
  4174. POSITION
  4175. PURPOSE
  4176. Sets the data pointer to a new position in an ASCII file.
  4177.  
  4178. SYNTAX
  4179. POSITION nexp
  4180.  
  4181. COMMENTS
  4182. When you read data from an ASCII file on disk, Superbase uses an internal
  4183. pointer to keep track of it. The OPEN file FOR INPUT command sets the pointer
  4184. to zero, the position of the first character in the file. Thereafter it is
  4185. incremented by one for each character that is input using the INPUT command.
  4186. POSITION sets the pointer to the character position specified by nexpr.
  4187. Normally, the data in an ASCII file is read into the computer sequentially. With Position, you can input character data on a more selective basis.
  4188. You will only be able to take advantage of this command if you know where the
  4189. data is stored in a file. Superbase stores data in variable length fields(as
  4190. opposed to fixed length fields):when you create an ASCII file from an '.sbf'
  4191. file by exporting it, the amount of space occupied on disk by field data may
  4192. vary from record to record. This means that there is no simple way of knowing
  4193. the position of any particular field or record.
  4194. One solution to this problem is to create an ASCII file from a database file
  4195. using the query option Output to Disk. When you do this, Superbase stores
  4196. the data in fixed length fields-each field takes the length set in the file
  4197. definition. You can then work out the number of characters occupied by a record in the ASCII and use this figure to retrieve specific records or fields. For example, if the record length was 49 characters, you would enter:
  4198.     POSITION 49 * 5 + 1:INPUT LINE a$
  4199. to retrieve the fifth record in the file(you need to add one because the first character position is zero).
  4200.  
  4201. EXAMPLES
  4202. 1    OPEN "Cust.asc" FOR INPUT
  4203.     FOR n%=0 to 76 * 12 STEP 77
  4204.     POSITION n%
  4205.     INPUT & 15, a$
  4206.     ? a$
  4207.     NEXT
  4208.     CLOSE INPUT
  4209.  
  4210. NOTES
  4211. This example inputs the first field from the first twelve records in the ASCII file Cust.asc. It assumes that the record length is 77 characters and that the length of the first field is 15 characters.
  4212.  
  4213. PRINT
  4214. PURPOSE
  4215. Sends information to the printer.
  4216.  
  4217. SYNTAX
  4218. PRINT[expressionlist]
  4219.  
  4220. COMMENT
  4221. PRINT, followed by a semicolon and nothing else, selects the printer as the
  4222. current output device. The ? command can then be used to send information to
  4223. the printer. You can also use PRINT to output information directly to the
  4224. printer, by following the command with one or more expressions. But note that
  4225. any use of PRINT makes the printer the current output device.
  4226. The items in the expression list following the Print command may be separated
  4227. by a semicolon or a comma. If a semicolon is used, Superbase will print the
  4228. expressions one after the another without any spaces in between; a comma has the effect of inserting a space between items. In some circumstances, you may also dispense with separators altogether. Thus, provided it can distinguish between different items, Superbase will accept a list of expressions which are entered on the line head to tail; for example:
  4229.     PRINT a$b$c%"Hello"
  4230.  
  4231. EXAMPLES
  4232. 1    PRINT;
  4233.     ? MEMORY
  4234.     DISPLAY;
  4235. 2    PRINT BF "The items in the following list will be printed in bold face"
  4236.     PRINT "One", "Two", "Three";CHR$(12)
  4237.     DISPLAY;
  4238.  
  4239. NOTES
  4240. The first example prints the current program's variables and their contents.
  4241. Example 2 prints a list of items, and then sends the form feed character -
  4242. CHR$(12)-to the printer. Both examples use the DISPLAY command to make the
  4243. screen the current output device after the print operation is finished.
  4244.  
  4245. PROTECT
  4246. PURPOSE
  4247. Saves the current program in an encrypted form.
  4248.  
  4249. SYNTAX
  4250. PROTECT filename
  4251.  
  4252. COMMENTS
  4253. Use this command to ensure that program files are not seen by anyone else. It
  4254. stores a file on disk in an encrypted(scrambled)form so that it can be run but not edited.
  4255. If the first line of a program is a REM statement, PROTECT displays that line, but hides the rest of the program from any attempt to edit or LIST it.
  4256.  
  4257. EXAMPLES
  4258. 1    PROTECT "myprog"
  4259.  
  4260. PROW
  4261. PURPOSE
  4262. Returns the row position of the print head on the current output printer.
  4263.  
  4264. SYNTAX
  4265. PROW(nexpr)
  4266.  
  4267. COMMENTS
  4268. If nexpr is zero, the function returns the row position of the print head on the current printer. For the Column position, see PCOL. See also LOCATE.
  4269. Giving nexpr a positive value resets Superbase's internal row counter. See
  4270. PCOL.
  4271.  
  4272. EXAMPLES
  4273. 1    x%=PROW(0)
  4274. 2    ? PROW(0)
  4275.  
  4276. QUIT
  4277. PURPOSE
  4278. Exits from Superbase.
  4279.  
  4280. SYNTAX
  4281. QUIT
  4282.  
  4283. COMMENTS
  4284. This has same effect as selecting the Quit option from the Project menu. It
  4285. exits from Superbase and returns the user to the desktop interface.
  4286.  
  4287. READ
  4288. PURPOSE
  4289. Reads the data given in a DATA statement and assigns it to a variable or field.
  4290.  
  4291. SYNTAX
  4292. READ var/field[, var/field] [, .....]
  4293.  
  4294. COMMENT
  4295. The types of variables or fields used with a READ command must match the types of data expected-numeric variables or numeric fields for numeric data and string variables or string fields for string data.
  4296. DML uses a pointer to keep track of where it is in the list of DATA items; that is, each time a data item is read, DML moves the pointer on to the next item in the list. If you wish to read the same data again, you can place a label in
  4297. front of a DATA statement and use RESTORE.
  4298.  
  4299. EXAMPLES
  4300. 1    READ a%, b$, fielda.filea, fielda.fileb
  4301.  
  4302. RECCOUNT
  4303. PURPOSE
  4304. Counts the number of records in a file.
  4305.  
  4306. SYNTAX
  4307. RECCOUNT(sbfname)
  4308.  
  4309. COMMENTS
  4310. This function returns a number showing how many records there are in the file
  4311. specified. You can use the empty string as an argument-RECCOUNT("")-to refer to the current file.
  4312.  
  4313. EXAMPLES
  4314. 1    ? RECCOUNT("Orders")
  4315.  
  4316.                 5-116
  4317.  
  4318. 2    x%=RECCOUNT(x$)
  4319. 3    OPEN FILE("address")
  4320.     SELECT FIRST
  4321.     FOR n%=1 to RECCOUNT("address")
  4322.     VIEW
  4323.     SELECT NEXT
  4324.     NEXT n%
  4325.  
  4326. NOTES
  4327. Example 3 displays all the records in the file "address" in turn.
  4328.  
  4329. REM
  4330. PURPOSE
  4331. Inserts a non-executable comment(a remark)into a program.
  4332.  
  4333. SYNTAX
  4334. REM[text]
  4335.  
  4336. COMMENTS
  4337. REM has the effect of cancelling any statements after it. This makes it useful when you are testing a program-placing it at the start of a multi-statement line puts the following statements temporarily out of action. More generally, use REM to annotate a program in order to explain how it works or what it does.
  4338. A single quotation mark after a command without an intervening colon also acts as a REM statement.
  4339.  
  4340. EXAMPLES
  4341. 1    REM this is a remark
  4342. 2    ....:FILE "aaa" open aaa
  4343. 3    ....:FILE "aaa":REM open aaa
  4344. 4    FILE "aaa":REM eliminate next commands:INDEX abc:SELECT 
  4345.     FIRST
  4346.  
  4347. NOTES
  4348. Examples 2 and 3 have identical effects and demonstrate the two different ways of entering a comment. In example 4, the REM statement means that the INDEX and SELECT FIRST commands are not executed.
  4349.  
  4350. REMOVE FILE
  4351. PURPOSE
  4352. Removes a database file from disk, along with its associated definition and
  4353. index files.
  4354.  
  4355. SYNTAX
  4356. REMOVE sbfname
  4357.  
  4358. COMMENT
  4359. This command operates in the same way as the Remove File menu option.
  4360. Note that you are not asked for confirmation-the file is just removed.
  4361.  
  4362. EXAMPLES
  4363. 1    REMOVE FILE "aaa"
  4364. 2    REMOVE FILE "DF1:aaa"
  4365. 3    REMOVE FILE "GEM\SBASE\aaa"
  4366.  
  4367. REMOVE FROM
  4368. PURPOSE
  4369. Removes records which match the conditions specified.
  4370.  
  4371. SYNTAX
  4372. REMOVE FROM FILE sbfname[WHERE conditions]
  4373.  
  4374. COMMENTS
  4375. This command works in the same way as the equivalent PROJECT-REMOVE-FILE menu
  4376. option. It deletes records from a file on disk.
  4377. FILE sbfname has to be open, and if the file requires a password, you must have full access to it.
  4378. WHERE conditions is optional and is set up in the same way as a filter. If it
  4379. is not included, the command acts on all the records in a file.
  4380.  
  4381. EXAMPLES
  4382. 1    REMOVE FROM FILE "aaa" WHERE Lastname LIKE "[a-c]*"
  4383. 2    REMOVE FROM FILE "aaa"
  4384. This empties the file of all its data.
  4385.  
  4386. REMOVE INDEX
  4387. PURPOSE
  4388. Removes an index on the current file from disk.
  4389.  
  4390. SYNTAX
  4391. REMOVE INDEX index
  4392.  
  4393. COMMENT
  4394. This command works in the same way as the Remove Index option on the Project
  4395. menu. The file must be open, and, if it requires a password, you must have full access privileges.
  4396. index is the name of an indexed field. It can be entered with a file extention.
  4397.  
  4398. EXAMPLES
  4399. 1    REMOVE fielda
  4400. 2    REMOVE fieldb.aaa
  4401.  
  4402. RENAME
  4403. PURPOSE
  4404. Renames a file on disk.
  4405.  
  4406. SYNTAX
  4407. RENAME old.filename[, /TO]new.filename
  4408.  
  4409. COMMENT
  4410. This command works in the same way as the RENAME command in MS DOS or Amiga
  4411. DOS, but allows you to rename a file without exiting from Superbase. You have
  4412. the option of using either a comma or the keyword TO as the separator between
  4413. the two file names.
  4414.  
  4415. EXAMPLES
  4416. 1    RENAME "aaa", "bbb"
  4417. 2    RENAME "aaa" TO "bbb"
  4418.  
  4419. REORGANIZE
  4420. PURPOSE
  4421. Reorganizes the current file or a specified file.
  4422.  
  4423. SYNTAX
  4424. REORGANIZE [FILE sbfname] [TO]sbfnameb
  4425.  
  4426. COMMENTS
  4427. This command is the program equivalent of the Reorganize option on the System
  4428. menu(see Chapter 8, Volume 1). It takes a file on disk, reorganizes it, and stores it as sbfnameb. IF the FILE option is not used, the current file is reorganized.
  4429. sbfnameb can include the pathname for another directory or disk. If you enter a pathname without a file name following it, the file will be reorganized under the same name.
  4430. Note that you cannot reorganize a file under the same name in the same
  4431. directory;i.e. if a pathname is not supplied, sbfnameb must not be the same as sbfnamea.
  4432.  
  4433. EXAMPLES
  4434. 1    FILE "aaa":REORGANIZE TO "copy"
  4435. 2    REORGANIZE "aaa" TO "a:mydir\"
  4436. 3    REORGANIZE "aaa" TO "DF1:Mydir/"
  4437. Example 1 creates a reorganized file 'copy' in the current directory, Example 2 creates a reorganized file 'aaa' in directory mydir on the disk in drive a (or, in example 3, drive DF1 on the Amiga).
  4438.  
  4439. REPLICATE
  4440. PURPOSE
  4441. Replicates a character a given number of times.
  4442.  
  4443. SYNTAX
  4444. REPLICATE(strexp, nexp)
  4445.  
  4446. COMMENTS
  4447. REPLICATE repeats the character in strexpr the number of times given in nexp.
  4448.  
  4449. EXAMPLES
  4450. 1    textfieldc=REPLICATE("*", 10)
  4451. 2    x$=REPLICATE(textfieldc, 4)
  4452. 3    x$=REPLICATE(MID$(x$, 4, 2), 6)
  4453. 4    x$=REPLICATE (" ", 25)
  4454.  
  4455. NOTES
  4456. Example 4 fills x$ with 25 spaces, but see function SPACE$.
  4457.  
  4458. REPORT
  4459. PURPOSE
  4460. Specifies the field or fields on which totals(and other report statistics) will be produced for the report as a whole.
  4461.  
  4462. SYNTAX
  4463. REPORT [SUMMARIZE] [params]fieldname[, fieldname][, ....]
  4464.  
  4465. COMMENT
  4466. Report has two uses. When you create a Report with the Forms Editor, Superbase generates a Report statement by noting the fields which have been specified in an AFTER REPORT section;i.e., if the AFTER REPORT section in a Report program contains the statements:
  4467.     ? SUM amount
  4468.     ? COUNT deposits
  4469. Superbase will generate the following line in the program:
  4470.     REPORT amount, deposits
  4471. If you are writing a Report program yourself (as opposed to modifying a program generated by Superbase), you should remember to enter a Report statement including the names of any fields for which you wish totals and other report statistics to appear.
  4472. The second application for REPORT is a query language command. In this context, it allows you to create a program line which is equivalent to the REPORT command line in the query definition dialog.
  4473. REPORT is used here to specify the fields for which totals and other
  4474. statistical.
  4475. When you use the SUMMARIZE option, Superbase suppresses the main detail of the report and prints just the summary information.
  4476.  
  4477. REQUEST
  4478. PURPOSE
  4479. Displays a Superbase dialog.
  4480.  
  4481. SYNTAX
  4482. REQUEST text1, text2, type[, nvar[, strvar[, len]]]
  4483.  
  4484. COMMENT
  4485. REQUEST allows you to select one of Superbase's dialogs and display it on
  4486. screen. To some extent you can also customise a dialog to your own
  4487. requirements. Thus you can place a title in box, and you can specify the text
  4488. string that initially appears in the dialog's command line or selection box.
  4489. For certain dialogs, it also possible to specify the length of the box.
  4490. text 1 and text2 are the first and second line of the dialog title. They must
  4491. be included although they can be "". The maximum length for each line is 50
  4492. characters.
  4493. type is the dialog type. It defines the type of dialog according to the table
  4494. shown below.
  4495. nvar is a numeric variable. It returns a value of 1 if OK is selected and there is an entry into the string dialog. If CANCEL is selected or there is no entry into the string dialog, it returns 0.
  4496. strvar can be used with dialogs which have a string entry box and has two
  4497. functions:
  4498. It is used to place a default value into the string box, i.e., the text string in strvar is entered into the string box when the dialog is displayed.
  4499. It returns the string which the user enters in the box.
  4500. len specifies the length of the string box(where appropriate). This is
  4501. particularly useful for the information dialogs. For dialog types 5-16 it is
  4502. not need as Superbase sets the box to the maximum file name length of 50
  4503. characters. For dialog type 4 len must be specified.
  4504.  
  4505. Types of Dialogs available:
  4506.  
  4507. TYPE    DIALOG            BUTTONS
  4508. 0    string            OK
  4509. 1    string            OK CANCEL
  4510. 2    string            OK
  4511. 3    string            OK CANCEL
  4512. 4    string            OK CLEAR CANCEL
  4513. 5    Database Files        OK CLEAR CANCEL
  4514. 6    Open Fields List    OK CLEAR CANCEL
  4515. 7    Indexed fields        OK CLEAR CANCEL
  4516. 8    Non indexed fields    OK CLEAR CANCEL
  4517. 9    Field Info        OK CLEAR CANCEL 
  4518. 10    Open Database Files    OK CLEAR CANCEL
  4519. 11    Database Files        OK CLEAR CANCEL
  4520. 12    Program Files        OK CLEAR CANCEL
  4521. 13    Text Files        OK CLEAR CANCEL
  4522. 14    Query Files        OK CLEAR CANCEL
  4523. 15    Update Files        OK CLEAR CANCEL
  4524. 16    Function Key Files    OK CLEAR CANCEL
  4525. 17    Directory listing    OK CLEAR CANCEL
  4526. 18    Subdirectory List    OK CLEAR CANCEL
  4527.  
  4528. Note that a database file must be open before dialogs 5 to 9 can be selected.
  4529.  
  4530. EXAMPLES
  4531. 1    REQUEST "", "", 2, 
  4532. 2    a%=0:a$="":REM initialize nvar and strvar
  4533.     REQUEST "Select a program", "", 5, a%, a$, 32
  4534.     IF a%=0 THEN ? "OK so you do not want to run a program":END
  4535.     CHAIN a$
  4536. 3    a%=0:a$=":OPEN FILE "aaa"
  4537.     REQUEST "Select an Index", "", 7, a%, a$
  4538.     IF a%=0 THEN END
  4539.     INDEX a$
  4540.     lablook:a$="":REQUEST "Enter a key", "", 1, a%, a$, 15
  4541.     IF a%=0 THEN END
  4542.     SELECT KEY a$
  4543.     IF FOUND ("aaa") THEN GOTO lablook2
  4544.     REQUEST "No Record with key" + a$, "See Nearest ?", 1a%
  4545.     IF a%=0 THEN GOTO lablook
  4546.     lablook2:VIEW:WAIT FOR 5:GOTO lablook
  4547.  
  4548. NOTES
  4549. Example 1 puts an "OK" dialog up for 2 seconds. Example 2 allows the user to
  4550. select a program to run. Example 3 in essence duplicates the key lookup
  4551. function from the ? button on the Superbase Control Panel. Note the
  4552. concatenation of the first title line of the dialog on the third from last
  4553. line.
  4554.  
  4555. RESTORE
  4556. PURPOSE
  4557. Moves the data pointer back to the first DATA statement, or to a specified
  4558. label.
  4559.  
  4560. SYNTAX
  4561. RESTORE[label]
  4562.  
  4563. COMMENTS
  4564. The data pointer is the internal pointer that Superbase uses to keep track of
  4565. which DATA statements have been read. Initially it has a value of zero and
  4566. points to the first DATA statement. As you READ data into variables or fields, the data pointer is increased by one for every data item read.
  4567. This command resets the data pointer. If you do not specify label, the data
  4568. pointer is reset to the beginning of the first DATA statement. If you specify
  4569. label, the data pointer is reset to the data statement following the label.
  4570.  
  4571. EXAMPLES
  4572. 1    RESTORE
  4573. 2    RESTORE datalabel1
  4574.  
  4575. RESUME
  4576. PURPOSE
  4577. Resumes execution after an error.
  4578.  
  4579. SYNTAX
  4580. RESUME[NEXT/label]
  4581.  
  4582. COMMENTS
  4583. The RESUME command works in conjunction with the ON ERROR GOTO command which is used to trap program errors.
  4584. RESUME, on its own, returns program control to the statement that caused the
  4585. error. When NEXT is included, the statement returns program control to the
  4586. statement after the one which caused the error.
  4587. label transfers program control to the label specified.
  4588.  
  4589. EXAMPLES
  4590. 1    REM Top of program
  4591.     ON ERROR GOTO errlab1
  4592.     SELECT FIRST:? fieldname
  4593.     .....
  4594.     .....
  4595.     errlab1:IF ERRNO=44 THEN OPEN FILE "aaa":REM file not open
  4596.     RESUME
  4597. 2    REM read data
  4598.     ON ERROR GOTO errlab2
  4599.     .....
  4600.     READ x$
  4601.     .....
  4602.     endread:.....
  4603.     .....
  4604.     .....
  4605.     errlab2:IF ERRNO=18 THEN RESUME endread:REM out of data
  4606.  
  4607. RETURN
  4608. PURPOSE
  4609. Returns from a subroutine.
  4610.  
  4611. SYNTAX
  4612. RETURN
  4613.  
  4614. COMMENTS
  4615. The RETURN command is used to mark the end of a subroutine. It instructs the
  4616. computer to transfer prgram control to the statement immediately following the GOSUB or ON GOSUB statement which initially called the subroutine. See GOSUB.
  4617.  
  4618. RIGHT$
  4619. PURPOSE
  4620. Extracts one or more characters from a text string or text field, starting from the right-hand end of the string.
  4621.  
  4622. SYNTAX
  4623. RIGHT$(strexpr, nexpr)
  4624.  
  4625. COMMENTS
  4626. This function starts at the right of a string given in strexpr and extracts
  4627. nexpr characters.
  4628.  
  4629. EXAMPLES
  4630. 1    textfieldc=RIGHT$(textfielda, 10)
  4631. 2    textfieldc=LCASE$(RIGHT$(textfielda, 1))
  4632. 3    IF RIGHT$(textfielda, 1)="s" THEN....
  4633. 4    x$=RIGHT$("ABCD", 2)
  4634. 5    x$=RIGHT$(x$, 4)
  4635.  
  4636. RND
  4637. PURPOSE
  4638. Returns a random number.
  4639.  
  4640. SYNTAX
  4641. RND(nexpr)
  4642.  
  4643. COMMENTS
  4644. What the function returns depends on the value of nexpr.
  4645. It nexpr is less than zero, the random number generator is reseeded. This means that a new series of random numbers will be generated, completely unrelated to the last series. It also allows you to generate the same series again for testing purposes, by entering the same seed.
  4646. If nexpr is zero, the number returned is the same as the previous one.
  4647. If nexpr is positive, a new random number is generated.
  4648. The random number returned is in the range 0 to 1. Technically, it is never zero and never unity, but all values between 0 and one will be randomly generated and the distribution of numbers will be relatively flat.
  4649.  
  4650. EXAMPLES
  4651. 1    numfieldc=RND(numfielda)
  4652. 2    numfieldc=RND(2) * 12
  4653. 3    textfieldc=MID$(x$, RND(2) * 6 + 1, RND(2) * 12 + 1)
  4654. 4    $x=RND($y)
  4655. 5    ? RND($x)
  4656.  
  4657. ROW
  4658. PURPOSE
  4659. Returns the row position of the cursor on the screen.
  4660.  
  4661. SYNTAX
  4662. ROW(0)
  4663.  
  4664. COMMENTS
  4665. This function shows how far down the screen the cursor is. For the column
  4666. position, see COL.
  4667.  
  4668. EXAMPLES
  4669. 1    x%=ROW(0)
  4670. 2    ? ROW(0)
  4671.  
  4672. NOTES
  4673. In practise, example 2 would be pointless, because it changes the position of the cursor in the course of printing it.
  4674.  
  4675. RUN
  4676. PURPOSE
  4677. Executes a program from memory, or loads it from disk and then runs it.
  4678.  
  4679. SYNTAX
  4680. RUN[filename]
  4681.  
  4682. COMMENTS
  4683. This will run the program currently in memory when used as a command or as a
  4684. program statement without the filename option. If filename is used to specify a program, Superbase loads the program from disk and then runs it.
  4685. If filename is specified, it must be a string variable or a string constant in quotation marks.
  4686.  
  4687. SAVE
  4688. PURPOSE
  4689. Saves any of the following types of file:program, text, function key, query, and update files.
  4690.  
  4691. SYNTAX
  4692. SAVE [TEXT/KEY/QUERY/UPDATE]filename[, TEXT]
  4693.  
  4694. COMMENTS
  4695. filename is required. Superbase detects files of different types as follows:
  4696.     aaa.sbk is a saved function key set
  4697.     aaa.sbp is a saved program
  4698.     aaa.sbq is a saved query
  4699.     aaa.sbt is a saved document(text)
  4700.     aaa.sbu is a saved update
  4701. If none of the options TEXT, KEY, QUERY or UPDATE is used, Superbase assumes that filename refers to an '.sbp' file and attempt to save a program file. If you include TEXT as the last parameter, DML saves a program file as a text file.
  4702. Only one of the options, TEXT, KEY, QUERY or UPDATE, can be used at a time.
  4703.  
  4704. SAVE FILE
  4705. PURPOSE
  4706. Saves the current file definition.
  4707.  
  4708. SYNTAX
  4709. SAVE FILE sbfname
  4710.  
  4711. COMMENTS
  4712. When you create a new file, you can use MAKE to save the file definition. SAVE FILE, however, must be used after you have edited a file definition with MODIFY.
  4713.  
  4714. SAY
  4715. PURPOSE
  4716. Converts a text string into speech, using the Amiga's speech synthesis facility.
  4717.  
  4718. SYNTAX
  4719. SAY [USING parameters]exprlist
  4720.  
  4721. COMMENTS
  4722. SAY is only available on the Amiga. The parameters for the USING option are in this order:
  4723.     Pitch, Inflection, Rate(wpm), Sex, Phonemic
  4724. The following table gives the range of each parameter and its default value:
  4725.  
  4726. PARAMETER        RANGE        DEFAULT        NOTES
  4727. Pitch        65-320        110
  4728. Inflection    0-1            0        0 is expressive, 1 is monotone
  4729. Rate in wpm    40-400        150
  4730. Sex            0-10            0        0 is male, 1 is female
  4731. Phonemic        0-1            0        0 translates to phonemes, 
  4732.                                 1 assumes phonemes
  4733.  
  4734. SAY only works with string expressions. To hear an external sound field use the SHOW command.
  4735.  
  4736. EXAMPLES
  4737. 1    OPEN FILE "Address"
  4738.     SELECT FIRST
  4739.     WHILE NOT EOF("Address")
  4740.     SAY Forename;Lastname;"comes from";City;Country
  4741.     SELECT NEXT
  4742.     WEND
  4743. 2    SAY USING 280, 1, 200, 1, 0"Hello there", USING 140, 1, 200, 0, 0
  4744.     "Well, hello there"
  4745.  
  4746. SCRDUMP
  4747. PURPOSE
  4748. Outputs a copy of the screen to the printer-carries out a screen dump.
  4749.  
  4750. SYNTAX
  4751. SCRDUMP
  4752.  
  4753. COMMENTS
  4754. Only available on the Amiga.
  4755.  
  4756. SECS
  4757. PURPOSE
  4758. Returns the numbers of seconds from a time field.
  4759.  
  4760. SYNTAX
  4761. SECS(nexpr)
  4762.  
  4763. COMMENTS
  4764. nexpr will usually contain a time in milliseconds(thousandths of a second)
  4765. from a time field or from the result of a TIMEVAL calculation.
  4766.  
  4767. EXAMPLES
  4768. 1    scnds%=SECS(timefield)
  4769. 2    scnds%=SECS(TIMEVAL("10:22AM"))
  4770.  
  4771. SELECT COMMANDS
  4772. The following SELECT commands relate to Record selection:
  4773.     SELECT CURRENT
  4774.     SELECT DUPLICATE
  4775.     SELECT FIRST
  4776.     SELECT KEY
  4777.     SELECT LAST
  4778.     SELECT NEXT
  4779.     SELECT PREVIOUS
  4780.     SELECT REMOVE
  4781.     SELECT WHERE
  4782.  
  4783. SELECT commands can only be used on an open database file, although this does
  4784. not have to be the current file.
  4785. These commands do not display records on screen. To do this, you need to use
  4786. VIEW. Similarly, although they can be used with any open file, the SELECT
  4787. commands do not automatically make an open file the current file.
  4788. For example, SELECT LAST selects the last record in a file(on index)even if the file is not current. If the file is current, executing the VIEW command will be enough to display the last record. But with any other open file, you will also need to use the FILE command(as opposed to the FILE parameter)before you can display the record(FILE makes an open file the current file).
  4789.  
  4790. SELECT CURRENT
  4791. PURPOSE
  4792. Selects the current record.
  4793.  
  4794. SYNTAX
  4795. SELECT CURRENT [FILE sbfname] [INDEX index]
  4796.  
  4797. COMMENT
  4798. This command has the same effect as the Current Record button on the Control
  4799. Panel at the bottom of the screen. Use INDEX to select the current record using a different index.
  4800.  
  4801. SELECT DUPLICATE
  4802. PURPOSE
  4803. Selects the next record with the same key.
  4804.  
  4805. SYNTAX
  4806. SELECT DUPLICATE [INDEX index]
  4807.  
  4808. COMMENTS
  4809. This command finds the next record with the same key as the current key. The
  4810. key is the field on which the file is currently indexed. If SELECT DUPLICATE
  4811. fails to find a record with the same key, the EOF function is set to true.
  4812.  
  4813. 1    SELECT FIRST:VIEW:x%=1
  4814.     lab1:SELECT DUPLICATE
  4815.     IF NOT EOF("aaa")THEN VIEW:x%=x% + 1:GOTO lab1
  4816.     ? "End of ";x%; "duplicates-strike key"
  4817.     lab2:SELECT PREVIOUS:SELECT NEXT:IF EOF("aaa")THEN END
  4818.     CLS:VIEW:GOTO lab1
  4819. Example 1 displays duplicate entries on an index. In Table view, it shows a set of records at a time.
  4820.  
  4821. SELECT FIRST
  4822. PURPOSE
  4823. Selects the first record in the current or specified index sequence.
  4824.  
  4825. SYNTAX
  4826. SELECT[FILE sbfname] [INDEX index]
  4827.  
  4828. COMMENTS
  4829. This command has the same effect as the First Record button on the Control
  4830. Panel. Use the INDEX parameter to alter the current index.
  4831.  
  4832. EXAMPLES
  4833. 1    SELECT FIRST
  4834. 2    SELECT FIRST "Stock" INDEX Prodcode
  4835.  
  4836. NOTES
  4837. Example 1 selects the first record in the current file according to the current index. Example 2 selects the first record in the Stock file according to the Procode index.
  4838.  
  4839. SELECT KEY
  4840. PURPOSE
  4841. Selects the first record with matching string.
  4842.  
  4843. SYNTAX
  4844. SELECT KEY string [FILE sbfname] [INDEX index]
  4845.  
  4846. COMMENTS
  4847. This command has the same effect as the Key Lookup button on the Control Panel.
  4848. It searches the file for the first record whose index field matches the string specified.
  4849. Unlike the other SELECT commands, this command does not affect the EOF function, but instead sets the FOUND Function(see the example given for FOUND).
  4850.  
  4851. EXAMPLES
  4852. 1    SELECT KEY "Zollinger"
  4853.     VIEW
  4854. 2    SELECT KEY "Johnson" FILE "Customer" INDEX Lastname
  4855.     IF FOUND("Customer")THEN FILE "Customer":VIEW
  4856.  
  4857. NOTES
  4858. Example 1 selects the record in the current file whose Lastname field contains the name Zollinger. It assumes that the current file is indexed on Lastname.
  4859. The program in example 2 selects the record in the Customer file whose Lastname field contains the name Johnson. The Customer file must have already been opened, but it does not have to be the current file. If the program finds a record with a matching key, it uses the FILE command to make the Customer file current and then displays the record.
  4860.  
  4861. SELECT LAST
  4862. PURPOSE
  4863. Selects the last record in the current or specified index sequence.
  4864.  
  4865. SYNTAX
  4866. SELECT [FILE sbfname] [INDEX index]
  4867.  
  4868. COMMENTS
  4869. Has the same effect as the Last Record button on the Control Panel.
  4870.  
  4871. SELECT NEXT
  4872. PURPOSE
  4873. Selects the next record in the current or specified index sequence.
  4874.  
  4875. SYNTAX
  4876. SELECT NEXT [FILE sbfname] [INDEX index]
  4877.  
  4878. COMMENT
  4879. Has the same effect as the Next Record button on the Control Panel.
  4880.  
  4881. SELECT PREVIOUS
  4882. PURPOSE
  4883. Selects the previous record in the current or specified index sequence.
  4884.  
  4885. SYNTAX
  4886. [FILE sbfname] [INDEX index]
  4887.  
  4888. COMMENTS
  4889. This command has the same effect as the Previous button on the Control Panel.
  4890.  
  4891. SELECT REMOVE
  4892. PURPOSE
  4893. Removes the current record in the current file or another open file.
  4894.  
  4895. SYNTAX
  4896. SELECT [FILE sbfname]
  4897.  
  4898. COMMENTS
  4899. This command has the same effect as the Remove option on the Record menu.
  4900.  
  4901. SELECT WHERE
  4902. PURPOSE
  4903. Selects first record that matches the filter conditions or removes the filter.
  4904.  
  4905. SYNTAX
  4906. SELECT WHERE[[FILE sbfname] [conditions]]
  4907.  
  4908. COMMENTS
  4909. This command has the same effect as the Filter button on the Control Panel.
  4910. conditions is set up in the same way as the string gadget in the Filter
  4911. requestor. If not specified, the current filter conditions are cleared.
  4912. SELECT WHERE can only be used to set a single file filter. If you enter the
  4913. name of a field which also occurs in another open file, you should include the file the file name as an extension. Otherwise, Superbase may assume you are attempting to use this command in a multi-file operation, and will issue the error message:
  4914.     Can't do this
  4915.     This Where statement must be single file
  4916. If you wish to set a multi-file filter - to select records whose field data
  4917. matches the data in another file - use the LOOKUP function or the query
  4918. language command WHERE.
  4919.  
  4920. EXAMPLE
  4921. 1    SELECT WHERE fielda LIKE "[a-c]"
  4922. 2    SELECT WHERE "Stock" fieldb LIKE "[a-c]"
  4923. 3    SELECT WHERE
  4924.  
  4925. NOTES
  4926. Once set, the Control Panel filters remains active until it is cleared. Example 3 clears the filter which may have been set by a previous SELECT WHERE command or by direct entry in the filter dialog.
  4927.  
  4928. QUERY LANGUAGE COMMANDS
  4929. DML's Query Language commans allow you to create a program which duplicates a
  4930. Superbase query. These commands are used in report programs created by the
  4931. Forms Editor; but they can also be used for any of the query applications
  4932. described in Chapter 11, Volume 1 - sorting records, creating complex multi-file filters, merging files, and so on.
  4933. In Superbase a query is defined by the four command lines in the query
  4934. definition dialog(Chapter 5, Volume 1, introduces this dialog;Chapter 11 explains it in more detail). These command lines can be reproduced in a program by using the query language commands. SELECT is used to define the Fields command line;
  4935. REPORT defines the Report command line;WHERE corresponds to the FILTER line; and ORDER is used for the Order line.
  4936. You will find a explanation of these commands under their respective keyword
  4937. entries. Here, we will describe how they work together to form a query section.
  4938. A query section must start with the SELECT command and it should end with END
  4939. SELECT. Any other query language commands are optional;you will include them
  4940. according to your requirements. Thus, if you wish to use a filter, you will
  4941. include a WHERE command within the query section.
  4942. Likewise, if you wish to use reporting functions such as SUM and COUNT, you will need to insert a REPORT command after the SELECT command and before END SELECT. You can think of REPORT, WHERE and ORDER as modifying the query output which is specified with the SELECT command. When SELECT is used on its own - to form a single line query section - it outputs data from each record in a specified file(or files)in turn. For example:
  4943.     SELECT Lastname.Address, Country.Address:
  4944.     END SELECT
  4945. This outputs a line showing the contents of the fields Lastname and Country for each of the records in the Address file. As such, SELECT works in the same way as the ? command except that it acts on all the records in a file.
  4946. If you inserted TO PRINTER after Country.Address in the example above, SELECT
  4947. would output data to the printer. The TO device parameter provides an
  4948. equivalent to the Output options in the query definition dialog. You can use to specify an output device other than the screen:the printer, an ASCII file, or a new '.sbf' file.
  4949.  
  4950. A QUERY LANGUAGE EXAMPLE
  4951. Any query created with the query definition dialog can be reproduced under
  4952. program control. We can illustrate this by converting a query file(an '.sbq'
  4953. file)into a program, taking the Deptran file supplied with the demonstration
  4954. file disk as an example.
  4955. Deptran can be displayed on screen using the LIST option from the System menu.
  4956. It looks like this:
  4957.     SB
  4958.     CLIENTS
  4959.     DEPOSITS
  4960.     Deposit Transaction Report
  4961.     ON "Clients" Firstname.Clients, Lastname.Clients, ON "Deposits"
  4962.     @24 Bank, Amount, Deposits
  4963.     REPORT SUM Amount COUNT GROUP Lastname.Clients SUM
  4964.     Amount
  4965.     Lastname.Clients=Lastname.Deposits
  4966.     Lastname.Clients
  4967. SB on the first line indicates that this is a Superbase Professional query file as opposed to one created in Superbase Personal. The next two lines contain the names of the database files which are associated with this query. 'Deposit Transaction Report' is the query title, and the remaining lines represent the four query command lines.
  4968. Before we can load this file into the Program Editor, we need to change its name to Deptran.sbp. To do this, select COPY from the System menu and, after selecting Deptran.sbq as the file to be copied, enter then name Deptran.sbp.
  4969. You can now load the file into the Program Editor using the Program open
  4970. option. Coverting it to a program is just a matter of deleting two lines and
  4971. inserting keywords in the others. Once you have made these changes, the program should look like this:
  4972.     OPEN FILES "CLIENTS"
  4973.     OPEN FILE "DEPOSITS"
  4974.     SELECT ON "Clients" Firstname.Clients, Lastname.Clients, ON
  4975.     "Deposits" @24 Bank, Amount, Deposits
  4976.     REPORT SUM Amount COUNT GROUP Lastname.Clients SUM
  4977.     Amount
  4978.     WHERE Lastname.Clients=Lastname.Deposits
  4979.     ORDER Lastname.Clients
  4980. Note that the report line is the same as in the query file and does not need to be altered.
  4981. If you now run this program, it will have the same effect as running Deptran
  4982. from the query definition dialog(by clicking on OK).
  4983.  
  4984. SELECT
  4985. PURPOSE
  4986. Specifies which are to be output from a query.
  4987.  
  4988. SYNTAX
  4989. SELECT [params]firlds[TO device]:[statements]:END SELECT
  4990.  
  4991. COMMENTS
  4992. SELECT is a Query Language command and can used on its own or with other Query Language commands to form a query section.
  4993. fields can be one or more field names from one or multiple files.params can be any of the output format parameters as listed in the section which describes the ? commands.
  4994. In addition, there are three format parameters which can only be used with the SELECT command:ON file, AS heading and FIELD. The syntax and function of these parameters in described in their respective sections in Chapter 11, Volume 1.
  4995. TO device specifies the device to which the query output will be sent. If it is not included output is to the screen. The device options are:
  4996.     TO PRINTER
  4997. Outputs to the printer.
  4998.     TO FILE file
  4999. Creates a new '.sbf' file on disk under the file name specified, using the query output.
  5000.     TO file
  5001. Outputs to the ASCII file on disk specified by file.
  5002. statements can be other query language statements formed with the commands
  5003. REPORT, WHERE, and ORDER.
  5004. END SELECT is used to indicate the end of a query section. It is not always
  5005. necessary to include END SELECT, but you must provide Superbase with some
  5006. indication of where the query section finishes and where the rest of the
  5007. program starts. Otherwise, the statements following the last line in the query section will be interpreted as part of a multi-line SELECT statement. As an alternative to END SELECT, you could use a blank line.
  5008.  
  5009. SER
  5010. PURPOSE
  5011. Returns the total number of records that have been created in a file.
  5012.  
  5013. SYNTAX
  5014. SER(filename)
  5015.  
  5016. COMMENTS
  5017. You can use the SER function to assign a serial number to each record in a
  5018. file. To do this, you need to define a field which will hold the serial number.
  5019. It should be defined as a constant field and should have SER("filename")as its constant formula. When you create the first record, it will be given the value 1. This value will then be incremented by one for each record you add to the file.
  5020. The difference between SER and RECCOUNT is that SER gives the total number of
  5021. records that have been created, irrespective of whether they have been deleted later. RECCOUNT returns the number of records currently in the file.
  5022.  
  5023. 1    ? SER("Stock")
  5024. 2    BLANK
  5025.     Recno.Stock=SER("STOCK")
  5026.     Price.Stock=14.95
  5027.     Description.Stock="Widget"
  5028.     STORE
  5029.  
  5030. SET
  5031. PURPOSE
  5032. Reads a text file and executes any commands in the file, or assigns variables
  5033. from a text file.
  5034.  
  5035. SYNTAX
  5036. SET filename
  5037.  
  5038. COMMENTS
  5039. This command reads in a text file and executes it as if it were a sequence of
  5040. command. The file, therefore, must contain valid DML commands. If the file holds a set of variables-which have previously been saved to disk by ? MEMORY-the variable assignments are executed. This provides a way of transferring variables between different programs when CHAIN is not appropriate. For example, Program 'a' can set up variables for Program 'c', but Program 'a' CHAINs to Program 'b'. Another application would be to communicate variables between different programs which are run on different days.
  5041.  
  5042. EXAMPLES
  5043. 1    ......
  5044.     process a
  5045.     ......
  5046.     OPEN "aaa" FOR OUTPUT:? MEMORY:CLOSE OUTPUT:DISPLAY
  5047.     another program
  5048.     SET "aaa"
  5049.     ......
  5050.     process b
  5051. 2    SET "abc"
  5052. 'abc' could be ASCII file which contains a set of function key assignments.
  5053.  
  5054. SET BUFFERS
  5055. PURPOSE
  5056. Sets the number of buffers Superbase uses as a disk cache.
  5057.  
  5058. SYNTAX
  5059. SET BUFFERS nexp
  5060.  
  5061. COMMENTS
  5062. Operates in the same way as the Buffers option in Set Menu Options, and
  5063. allocates 512 bytes memory space for each buffer.
  5064. nexp can have a value from 1 to 99.
  5065.  
  5066. EXAMPLES
  5067. 1    SET BUFFERS 24
  5068.  
  5069. SET PAGING
  5070. PURPOSE
  5071. Sets paging on or off.
  5072.  
  5073. SYNTAX
  5074. SET PAGING[ON/OFF]
  5075.  
  5076. COMMENTS
  5077. When used without ON/OFF, it acts as toggle and operates in the same way as the SET-PAGING menu options. With ON or OFF, it sets paging accordingly.
  5078.  
  5079. EXAMPLES
  5080. 1    SET PAGING OFF
  5081.  
  5082. SET VIEW MODE
  5083. PURPOSE
  5084. Sets the view mode or switches between one of the view modes and a Form.
  5085.  
  5086. SYNTAX
  5087. SET [TABLE]/[FORM]/[RECORD]
  5088.  
  5089. COMMENTS
  5090. Works in the same way as the equivalent Set Menu option, except that it does not automatically display a record(use VIEW).
  5091. If a Form(as opposed to Form view)is displayed, the SET command switches the
  5092. Form off and selects the specified view mode. The Form remains in memory and
  5093. can be switched on again by repeating the SET command for the same view mode.
  5094. In other words, when a Form has been opened, the SET command toggles the current view mode on and off.
  5095.  
  5096. EXAMPLES
  5097. 1    SET FORM
  5098. 2    SET TABLE:VIEW
  5099.  
  5100. SGN
  5101. PURPOSE
  5102. Finds the sign of a number.
  5103.  
  5104. SYNTAX
  5105. SGN(nexpr)
  5106.  
  5107. COMMENTS
  5108. This function returns the positive value of 1 if nexpr is positive and returns the negative value -1 if nexpr is negative.
  5109.  
  5110. EXAMPLES
  5111. 1    numfieldc=SGN(numfielda)
  5112. 2    IF SGN(datefielda-datefieldb)THEN GOTO lab1
  5113. 3    x%=SGN(y%)
  5114. 4    x%=SGN(y% * numfielda * (datefielda-datefieldb))
  5115. 5    x%=SGN(VAL(RIGHT$(textfielda, 5)))
  5116. 6    ? SGN(x%)
  5117.  
  5118. NOTES
  5119. Example 2 tests whether datefieldb is later than datefielda
  5120.  
  5121. SHOW
  5122. PURPOSE
  5123. Shows an external file.
  5124.  
  5125. SYNTAX
  5126. SHOW [field]/[strexpr]
  5127.  
  5128. COMMENTS
  5129. SHOW is the program equivalent of the camera button at the bottom of the
  5130. screen. It displays a picture or text from an external file.field must be a
  5131. field which holds the name of the external file, but it does not have to be a
  5132. field in the current file:if you add a file name extension to the field name, 
  5133. you can display pictures using other open database files.
  5134. As an alternative to specifying an external field, strexpr allows you to specify the name of an external file.
  5135. When field or strexpr is not given, SHOW removes the picture from the screen.
  5136.  
  5137. SIN
  5138. PURPOSE
  5139. Returns the sine of an angle measured in radians.
  5140.  
  5141. SYNTAX
  5142. SIN(nexpr)
  5143.  
  5144. COMMENTS
  5145. This function returns the sine of the angle in nexpr, where the angle is
  5146. measured in radians. To convert degrees to radians, multiply by 180/PI.
  5147.  
  5148. EXAMPLES
  5149. 1    numfieldc=SIN(numfielda)
  5150. 2    x%=SIN(y%)
  5151. 3    x%=SIN(VAL(x$))
  5152. 4    ? SIN(x%)
  5153.  
  5154. SPACE$
  5155. PURPOSE
  5156. Fills a string with a specified number of spaces.
  5157.  
  5158. SYNTAX
  5159. SPACE$(nexpr)
  5160.  
  5161. COMMENTS
  5162. nexpr must be in the range 0 to 255.
  5163.  
  5164. EXAMPLES
  5165. 1    textfieldc=SPACE$(10)
  5166. 2    x$=SPACE$(4)
  5167.  
  5168. SQR
  5169. PURPOSE
  5170. Returns the square root of a number
  5171.  
  5172. SYNTAX
  5173. SQR(nexpr)
  5174.  
  5175. COMMENTS
  5176. The function returns the square root of the number specified by nexpr. If nexpr is less than zero, the function returns the error message 'ivalid number'.
  5177.  
  5178. EXAMPLES
  5179. 1    numfieldc=SQR(numfielda)
  5180. 2    numfieldc=SQR(2 * numfirlda)
  5181. 3    textfieldc=STR$(SQR(VAL(x$)))
  5182. 4    x%=SQR(y%)
  5183.  
  5184. STORE
  5185. PURPOSE
  5186. Stores the current record in the current file or in the file specified.
  5187.  
  5188. SYNTAX
  5189. STORE[, 0/1/2] [FILE sbfname]
  5190.  
  5191. COMMENTS
  5192. This command stores the record in memory for the current file, or for the file specified with sbfname.
  5193. It is equivalent to the Save option on the Record menu.
  5194.  
  5195. The numeric parameters - 0, 1 or 2 - allow you to specify whether the record is stored in batch mode or in the normal way(see the section on Batch in Chapter 5, Volume 1).
  5196. STORE, 1 stores the current record in batch mode. The time taken to save the
  5197. record on disk will be reduced, but the data will not yet be secure:if you
  5198. suffer a power loss, you will lose any record data which has been saved(in the current session)using this option. Note that STORE, 1 only turns on batch mode for the current record.STORE, 2 does not store a record but makes the file secure. Any records that have been saved previously with the STORE, 1 command will now be made safe on disk. You should always execute a STORE, 2 command after storing records in batch mode.
  5199. STORE, 0 is optional and is the same as STORE on its own:Superbase makes each
  5200. record secure as it is stored. If you were to turn the computer off
  5201. accidentally, the most you would lose would be the data in memory.
  5202.  
  5203. EXAMPLES
  5204. 1    BLANK
  5205.     Firstname="John"
  5206.     Lastname="Roberts"
  5207.     Street="15 Richmond Way"
  5208.     ......
  5209.     ......
  5210.     ......
  5211.     STORE
  5212. 2    FOR n%=1 to 10
  5213.     BLANK
  5214.     Firstname=Recdata$(n%, 1)
  5215.     Lastname=Recadata$(n%, 2)
  5216.     Street=Recdata$(n%, 3)
  5217.     ......
  5218.     ......
  5219.     ......
  5220.     STORE, 1
  5221.     NEXT
  5222.     STORE, 2
  5223.  
  5224. NOTES
  5225. The first example creates a new record and stores it in the normal way. Example 2 creates ten new records, reading data into the fields for each record from the array Recdata$ and storing them in batch mode. When all the records have been stored, it makes the file secure with the STORE, 2 command.
  5226.  
  5227. STR$
  5228. PURPOSE
  5229. Returns the text equivalent of a numeric expression.
  5230.  
  5231. SYNTAX
  5232. STR$(nexpr [[, nexpri [, nexprd]]/[, numeric-format-string]])
  5233.  
  5234. COMMENTS
  5235. STR$ converts data which is held in a numeric variable or numeric field into a text string.
  5236. nexpri specifies the number of integers before the decimal point and should be set large enough to avoid overflow display. nexprd specifies the number of
  5237. integers after the decimal point. The maximum numeric format in Superbase is a total of 13 integers, so nexpri plus nexprd must be less than 14. As an
  5238. alternative to using nexpri and nexprd, you can specify the numeric format as a string(see NUMBASE). If these parameters are not used, the default numeric
  5239. format set by Numeric Format on the Set menu or by the most recent use of
  5240. NUMBASE will be taken. The complementary function to STR$ is VAL.
  5241.  
  5242. EXAMPLES
  5243. 1    textfieldc=STR$(numfielda)
  5244. 2    textfieldc-STR$(numfielda, 5, 0)
  5245. 3    x$=STR$(165.4444, "z999999.00")
  5246.  
  5247. TAN
  5248. PURPOSE
  5249. Returns the tangent of an angle measured in radians.
  5250.  
  5251. SYNTAX
  5252. TAN(nexpr)
  5253.  
  5254. COMMENTS
  5255. The function returns the tangent of the angle in nexpr measured in radians. The complementary function of TAN is ATN.
  5256.  
  5257. EXAMPLES
  5258. 1    numfieldc=TAN(numfielda)
  5259. 2    x%=TAN(y%)
  5260. 3    x%=TAN(VAL(x$))
  5261. 4    ? TAN(x%)
  5262.  
  5263. THOUSECS
  5264. PURPOSE
  5265. Takes a numeric value and returns the number of thousandths of a second left
  5266. over after subtracting the number of seconds.
  5267.  
  5268. SYNTAX
  5269. THOUSECS(nexpr)
  5270.  
  5271. COMMENTS
  5272. nexpr will usually contain a time in milliseconds from a time field or the
  5273. result of a TIMEVAL calculation. THOUSECS returns the same result as nexpr MOD 1000.
  5274.  
  5275. 1    x%=THOUSECS(timefield)
  5276.  
  5277. TIME$
  5278. PURPOSE
  5279. Returns the time in string format from a numeric value which gives the time in thousandths of a second.
  5280.  
  5281. SYNTAX
  5282. TIME$(nexpr [, timeformat])
  5283.  
  5284. COMMENTS
  5285. The second argument for this function, timeformat, allows you to specify the
  5286. format the time string will have. It must conform to the rules for Superbase
  5287. time formats given in the keyword entry for DATEBASE.
  5288.  
  5289. EXAMPLES
  5290. 1    x$=TIME$(timefield)
  5291. 2    ? TIME$(NOW, "hh:mm:ssam")
  5292.  
  5293. TIMEVAL
  5294. PURPOSE
  5295. Returns the value of a time string in thousandths of a second.
  5296.  
  5297. SYNTAX
  5298. TIMEVAL(strexpr)
  5299.  
  5300. COMMENTS
  5301. strexpr must contain the time in a valid time format. See the keyword entry for DATEBASE for a list of acceptable time formats.
  5302.  
  5303. EXAMPLES
  5304. 1    t%=TIMEVAL("10:22am")
  5305. 2    t%=TIMEVAL("14:03:12.201")
  5306.  
  5307. TODAY
  5308. PURPOSE
  5309. Gives the system date.
  5310.  
  5311. SYNTAX
  5312. TODAY
  5313.  
  5314. COMMENTS
  5315. TODAY shows the date in the date format as set with Date Format option in the
  5316. Set menu, or as set by the DATEBASE command. If your computer has a real-time
  5317. clock or you have set the systeme date, TODAY gives the current date. Otherwise, it gives the default system date.
  5318. TODAY holds the date as a julian date number. Superbase automatically
  5319. translates this into the current date format when you display the date using ?
  5320. TODAY.
  5321.  
  5322. EXAMPLES
  5323. 1    ? TODAY
  5324. 2    datefield=TODAY
  5325. 3    ? MONTH(TODAY)
  5326.  
  5327. TRIM$
  5328. PURPOSE
  5329. Trims trailing spaces from a string or a text field.
  5330.  
  5331. SYNTAX
  5332. TRIM$(strexpr)
  5333.  
  5334. COMMENTS
  5335. This returns the string consisting of the original string specified by strexpr with any trailing spaces eliminated.
  5336.  
  5337. EXAMPLES
  5338. 1    stringfieldc=TRIM$(textfielda)
  5339. 2    x$=TRIM$(textfieldc.filea)
  5340. 3    ? LEN(x$);LEN(TRIM$(x$)
  5341.  
  5342. UCASE$
  5343. PURPOSE
  5344. Returns the upper case equivalent of a text string or a text field.
  5345.  
  5346. SYNTAX
  5347. UCASE$(strexpr)
  5348.  
  5349. COMMENTS
  5350. UCASE$ returns the upper case equivalent of the lowercase alphabet;no other
  5351. characters, including those already in upper case, are affected.
  5352. The complementary function of UCASE$ is UCASE$.
  5353.  
  5354. EXAMPLES
  5355. 1    textfieldc=UCASE$(textfielda)
  5356. 2    x$=UCASE$(y$)
  5357. 3    x$=UCASE$("ABCDEF")
  5358.  
  5359. NOTES
  5360. If you wish to set the first letter of a string to upper case, leaving the rest in lower case, you can so using the FCASE$ function.
  5361.  
  5362. UPDATE
  5363. PURPOSE
  5364. Performs a relational update.
  5365.  
  5366. SYNTAX
  5367. UPDATE[calclist] [WHERE conditions] [END UPDATE]
  5368.  
  5369. COMMENTS
  5370. UPDATE on its own runs the update in memory. This may have been loaded from
  5371. disk with the LOAD UPDATE command, or it may have been created in the same
  5372. session using the Process menu option Update Edit. By specifying calclist and conditions, you can also use UPDATE to define an update and then run it. calclist corresponds to command line set in the Update Fields dialog; conditions corresponds to the filter which is set in the Update Filter dialog. The first specifies how the records are updated, the second specifies which records are to be updated.
  5373. WHERE conditions and calclist should be entered as separate statements, either on the same line as UPDATE separated by colons, or on separate lines. They form part of an Update program section, headed by the UPDATE command and ending with END UPDATE.
  5374. The END UPDATE command must be included if the Update section is followed by
  5375. other statements in a program. Otherwise Superbase will regard these as
  5376. belonging to the Update section. As an alternative to using this command, you
  5377. can terminate the section with a colon or a blank line.
  5378. UPDATE is a multi-file command, so both conditions and calclist can refer to
  5379. more than one file. In this case, the first condition in the update filter must establish a join between two files.
  5380.  
  5381.                 5-155
  5382.  
  5383. EXAMPLES
  5384. 1    LOAD UPDATE "Newrate":UPDATE
  5385. Loads the Update file Newrate from disk, and then runs it.
  5386. 2    UPDATE
  5387.     Price.Orders=Price.Stock
  5388.     WHERE Product_Code.Orders=Product_Code.Stock AND
  5389.     Order_date "15 July 1987"
  5390.     END UPDATE
  5391. Updates prices in the Orders file on the basis of the price details in the
  5392. Stock file.
  5393.  
  5394. VAL
  5395. PURPOSE
  5396. Returns the numeric value of a text string.
  5397.  
  5398. SYNTAX
  5399. VAL(strexpr)
  5400.  
  5401. COMMENTS
  5402. The function returns the numeric value of the number(if any)in the lefthand end of the string or substring specified in strexpr. In cases where strexpr does not contain a number or where the leftmost character of strexpr is not numeric, the function returns 0.
  5403. The complementary function of VAL is STR$
  5404.  
  5405. EXAMPLES
  5406. 1    numfieldc=VAL(textfielda)
  5407. 2    numfieldc=VAL(RIGHT$(textfielda, 8))
  5408. 3    VAL(textfielda) > 1 AND VAL(RIGHT$(textfielda, 4) > 0
  5409. 4    x%=VAL("12.45A456")
  5410. 5    x%=VAL(x$)
  5411.  
  5412. VIEW
  5413. PURPOSE
  5414. Displays the current record in the current file.
  5415.  
  5416. SYNTAX
  5417. VIEW
  5418.  
  5419. COMMENTS
  5420. Allows the user to see the current record in the current file in the view
  5421. format specified by the SET view mode command. It can also be used to redisplay the current Form.
  5422.  
  5423. WAIT
  5424. PURPOSE
  5425. Waits for a specified time or until a key is pressed.
  5426.  
  5427. SYNTAX
  5428. WAIT [FOR time]/[FOR nexp] [var/field]
  5429.  
  5430. COMMENTS
  5431. Wait waits for a given number of seconds(FOR nexp)or until a given time(FOR
  5432. time).
  5433. FOR nexp implies 'wait for nexp seconds'.
  5434. FOR time implies 'eait until the system clock reached time', where the time is given in the current time format.
  5435. FOR var/field implies 'wait until a key is pressed, and then place it in var or field'. If you follow WAIT with a numeric variable or numeric field, it will only accept a number. In other word, pressing any key except the keys with the digits 0 to 9, will have no effect.
  5436.  
  5437. EXAMPLES
  5438. 1    WAIT FOR 3
  5439. Waits for 3 seconds.
  5440. 2    WAIT FOR 10:20:30
  5441. Wait until 10:20 am.
  5442. 3    WAIT x$
  5443. Waits for a single key stroke and puts it in x$.
  5444.  
  5445. WHERE
  5446. PURPOSE
  5447. Set the filter conditions for a query or a report.
  5448.  
  5449. SYNTAX
  5450. WHERE conditions
  5451.  
  5452. COMMENTS
  5453. WHERE is the program equivalent of the Filter command line in a query
  5454. definition, and can only be used within a section that is headed by the query
  5455. SELECT command. You can use WHERE to set a filter on the fields selected for
  5456. report output or for other query applications, such as sorting, merging files, or simply retrieving data with query that has been saved to disk.
  5457. conditions takes the same form as the Filter command line in the query
  5458. definition dialog(see Chapter 11, Volume 1). WHERE is a multi-file filter
  5459. command - unlike the record selection command SELECT WHERE - and if it used for this purpose, the join between two files must be placed at the beginning of the statement, as in:
  5460.     WHERE Lastname.Clients=Lastname.Deposits
  5461. Any subsidiary conditions can then be added to the line using the AND operator.
  5462.  
  5463. EXAMPLES
  5464. 1    SELECT Firstname.Clients, Lastname.Clients, Bank, Amount
  5465.     WHERE Lastname.Clients=Lastname.Deposits AND
  5466.     Lastname.Clients LIKE "[d-3]*"
  5467.     ORDER Lastname.Clients
  5468.     END SELECT
  5469. 2    WHERE Price > = 50 AND Price < = 100
  5470. 3    WHERE Lastname LIKE ["a-c"*] AND NOT (Country=USA)
  5471.  
  5472. NOTES
  5473. In the first exampe, WHERE is used to set up a multi-file filter. It selects
  5474. only those clients whose details are also stored in the Deposits file and whose last name initial falls in the range A to C. Note that file extension must be given for Lastname since the field occurs in both the Clients file and the Deposits file; the Bank and Amount fields do not require an extension name since they only occur in the Deposits file. The other two examples show WHERE in use as a single file filter command.
  5475.  
  5476. WHILE WEND
  5477. PURPOSE
  5478. Executes a series of instructions as long as the specified conditions are true.
  5479.  
  5480. SYNTAX
  5481. WHILE exp statements WEND
  5482.  
  5483. COMMENTS
  5484. WHILE and WEND set up a loop, in which the statement in between are executed
  5485. repeatedly for as long as the expression following WHILE is true. When the
  5486. expression is not true, execution resumes with the first statement after WEND.
  5487.  
  5488. EXAMPLES
  5489. 1    OPEN FILE "Address"
  5490.     SELECT FIRST
  5491.     WHILE NOT EOF("Address")
  5492.     VIEW
  5493.     SELECT NEXT
  5494.     WEND
  5495. 2    WHILE NOT EOF(*"):INPUT &1, a$:? a$:WEND
  5496.  
  5497. YEAR
  5498. PURPOSE
  5499. Returns a numeric value for the year from a julian date number.
  5500.  
  5501. SYNTAX
  5502. YEAR(nexp)
  5503.  
  5504. COMMENTS
  5505. The function is only valid for dates from 1 January 1 to the end of December
  5506. 9999. Consequently nexpr is only valid in the range 1 to 3652048. If nexpr is 0 then the number returned is 0. If nexpr is negative the results are
  5507. unpredictable. Associated date functions are DATE$ DAY DAYS DAY$ MONTH
  5508.  
  5509. EXAMPLES
  5510. 1    numfieldc=YEAR(datefielda)
  5511. 2    numfieldc=YEAR(datefielda + 90)
  5512. 3    numfieldc=YEAR(TODAY)
  5513. 4    x%=YEAR(datefielda + VAL(textfielda))
  5514. 5    x%=YEAR(DAYS("11 Jan 85")
  5515. 6    ? YEAR(datefielda + 30)
  5516. 7    YEAR(datefielda)=1986
  5517.  
  5518. NOTES
  5519. Example 3 provides a calculation to insert the month number of the system date into a numeric field. Example 7 provides a filter to pick out all the dates in datefields which fall in the year 1986.
  5520.  
  5521.             CHAPTER 6 - QUICK REFERENCE GUIDE
  5522.  
  5523. APPLICATION FUNCTIONS
  5524.  
  5525. RUN [filename]
  5526. Execute program, optionally loading from disk
  5527.  
  5528. CHAIN filename
  5529. Execute program without clearing variables
  5530.  
  5531. NEW [TEXT/QUERY/UPDATE]
  5532. Clear program or text area
  5533.  
  5534. EDIT [TEXT/KEY/QUERY/UPDATE]
  5535. Allow user to edit program, text, query or update
  5536.  
  5537. LOAD [TEXT/KEY/QUERY/UPDATE] filename [, APPEND]
  5538. Load program, text, file, function key list, query or update
  5539.  
  5540. SAVE [TEXT/KEY/QUERY/UPDATE] filename [, TEXT]
  5541. Save program, text file, function key list, query or update
  5542.  
  5543. PROTECT [filename]
  5544. Save the current program in encrypted form
  5545.  
  5546. CALL function
  5547. Call a user supplied function
  5548.  
  5549. SYSTEM COMMANDS
  5550.  
  5551. DEBUG [ON/OFF]
  5552. Set or clear debug flag
  5553.  
  5554. BREAK [ON/OFF]
  5555. Set or clear user stop enabled
  5556.  
  5557. QUIT
  5558. Exit Superbase system
  5559.  
  5560. KEY keynum [, string]
  5561. Set keynum to string or clear it
  5562.  
  5563. LIST filename
  5564. List any system file to screen
  5565.  
  5566. DELETE filename
  5567. Delete any system file
  5568.  
  5569. RENAME old filename [, TO] new filename
  5570.  
  5571. COPY from filename [, TO] to filename
  5572. Copy any system file
  5573.  
  5574. NUMBASE string
  5575. Set default numeric format
  5576.  
  5577. DATEBASE string
  5578. Set default date format
  5579.  
  5580. DIRECTORY path
  5581. Change directory to path
  5582.  
  5583. SET TABLE/RECORD/FORM
  5584. Set view according to parameter 
  5585.  
  5586. SET PAGING [ON/OFF]
  5587. Set paging
  5588.  
  5589. SET BUFFERS nexp
  5590. Set number of cache buffers to use
  5591.  
  5592. BASIC STATEMENTS
  5593.  
  5594. [LET] var/field=exp
  5595. Assign value of expression to variable or field
  5596.  
  5597. ERASE varlist
  5598. Remove a variable from memory
  5599.  
  5600. CLEAR
  5601. Clear all system variables
  5602.  
  5603. READ var/field [, var/field]
  5604. Read data into variables or fields from data pointer
  5605.  
  5606. DATA constant [, constant]...
  5607. Specify data for READ statement
  5608.  
  5609. RESTORE [label]
  5610. Move data pointer to specified position or home
  5611.  
  5612. REM text
  5613. Non executable comment line
  5614.  
  5615. EXECUTE string
  5616. Execute text string as though command
  5617.  
  5618. DIM array variable
  5619. Set array dimensions
  5620.  
  5621. CONTROL FLOW
  5622.  
  5623. FOR var=nexp TO nexp [STEP nexp]statements NEXT [var]
  5624. Repeat program lines a number of times
  5625.  
  5626. GOSUB label
  5627. Call a procedure or subroutine
  5628.  
  5629. GOTO label
  5630. Call a procedure or subroutine
  5631.  
  5632. GOTO label
  5633. Branch to the specified label
  5634.  
  5635. ON ERROR [GOTO label]
  5636. Specify procedure to be followed on error condition
  5637.  
  5638. ON nexp GOTO label [, label]...
  5639. Branch to statement or label in list
  5640.  
  5641. ON nexp GOSUB label [, label]...
  5642. Call procedure or subroutine in list
  5643.  
  5644. RETURN
  5645. Return from procedure or subroutine execution
  5646.  
  5647. RESUME [NEXT / label]
  5648. Resuume execution after error at next or specified position
  5649.  
  5650. END
  5651. Terminate execution of application
  5652.  
  5653. WHILE expr
  5654. Perform following commands if expression true
  5655.  
  5656. WEND
  5657. Mark end of while command sequence
  5658.  
  5659. CONDITIONALS
  5660.  
  5661. IF exp THEN statement/label [ELSE statement/label]
  5662. Conditional statement or expression execution
  5663.  
  5664. varfield=exp ? expr:expr
  5665. Conditional assignment of value to field or variable
  5666.  
  5667. FILE AND INDEX COMMANDS
  5668.  
  5669. CREATE sbfname;passwords
  5670. Create a new database file in memory
  5671.  
  5672. CREATE INDEX ON exp [FILE sbfname] [TO index] [UNIQUE]
  5673. Create a new index file optionally make unique
  5674.  
  5675. ADD [FILE sbfname] field definition string [, formula string]
  5676. Add a new field to a file
  5677.  
  5678. MAKE sbfname
  5679. Make the file exist on disk and store the file def
  5680.  
  5681. MODIFY field [, ] field definition string [, formula string]
  5682. Modify parameters for field changing name, type etc.
  5683.  
  5684. SAVE FILE sbfname
  5685. Save the current file definition
  5686.  
  5687. PASSWORD sbfname;passwords
  5688. Set new passwords for a specified file
  5689.  
  5690. REORGANIZE [FILE sbfname] [TO] pathname
  5691. Reorganize current or specified file to new pathname
  5692.  
  5693. OPEN FILE sbfname;passwords
  5694. Open file set as default
  5695.  
  5696. CLOSE [ALL]/[FILE sbfname]
  5697. Close all or specified files
  5698.  
  5699. FILE sbfname
  5700. Select the default file to be used
  5701.  
  5702. INDEX index
  5703. Select the default index to be used for a file
  5704.  
  5705. REMOVE FILE sbfname
  5706. Remove all data, file and all indices
  5707.  
  5708. REMOVE INDEX index
  5709. Remove the specified index for specified file
  5710.  
  5711. OPEN FIELDS [FILE sbfname] fieldlist
  5712. Open a set of fields for specified file
  5713.  
  5714. CLOSE FIELDS [FILE sbfname]
  5715. Close the open fields for specified file
  5716.  
  5717. RECORD COMMANDS
  5718.  
  5719. BLANK [FILE sbfname]
  5720. Clear all data from current record
  5721.  
  5722. STORE [0/1/2, ] [FILE sbfname]
  5723. Store current record in the file, batch mode optional.
  5724.  
  5725. ENTER [field/nexpr] [, nexpr2]
  5726. Allow the user to enter a record in the current file
  5727.  
  5728. VIEW
  5729. View record in the current file
  5730.  
  5731. SELECT
  5732. Record selection commands
  5733.  
  5734. SELECT FIRST [FILE sbfname] [INDEX index]
  5735. Select the first record in key sequence
  5736.  
  5737. SELECT LAST [FILE sbfname] [INDEX index]
  5738. Select the last record in key sequence
  5739.  
  5740. SELECT NEXT [FILE sbfname] [INDEX index]
  5741. Select the next record in key sequence
  5742.  
  5743. SELECT PREVIOUS [FILE sbfname] [INDEX index]
  5744. Select the previous record in key sequence
  5745.  
  5746. SELECT CURRENT [FILE sbfname] [INDEX index]
  5747. Select the current record in key sequence
  5748.  
  5749. SELECT DUPLICATE [FILE sbfname] [INDEX index]
  5750. Select the next record with the same key
  5751.  
  5752. SELECT REMOVE [FILE sbfname]
  5753. Remove the current record in selected file
  5754.  
  5755. SELECT KEY string [FILE sbfname] [INDEX index]
  5756. Select the first record with index matching string
  5757.  
  5758. SELECT WHERE [FILE sbfname] [conditions]
  5759. Select the first record matching conditions or clear conditions
  5760.  
  5761. SELECT field parms [WHERE parms] [REPORT parms] [ORDER parms]
  5762. [SAY]/[TO PRINTER/filename/FILE sbfname] [END SELECT]
  5763. Query language command
  5764.  
  5765. PROCESS COMMANDS
  5766.  
  5767. UPDATE calc list [WHERE conditions] [END UPDATE]
  5768. Perform relational update
  5769.  
  5770. REMOVE FROM FILE sbfname WHERE conditions
  5771. Remove records matching conditions
  5772.  
  5773. IMPORT filename [[TO] FILE sbfname] [WHERE conditions] [USING parms]
  5774. Import external text file to superbase
  5775.  
  5776. EXPORT [FILE sbfname] [INDEX index] [TO] filename [WHERE
  5777. conditions [USING parms]
  5778. Export to external file
  5779.  
  5780. LABELS [FILE sbfname] [WHERE conditions] [USING labelstring]
  5781. Print labels as per label definition
  5782.  
  5783. MERGE [TEXT filename [WHERE conditions]
  5784. Load text file and mail merge
  5785.  
  5786. INPUT OUTPUT FUNCTIONS
  5787.  
  5788. SHOW field/strexpr
  5789. Show external field
  5790.  
  5791. OPEN filename FOR INPUT/OUTPUT/APPEND/COMM
  5792. Open sequential file for input/output
  5793.  
  5794. POSITION nexp
  5795. Position in sequential file
  5796.  
  5797. INPUT [&nexp/LINE] var/field
  5798. Input characters or line from text file
  5799.  
  5800. CLOSE INPUT/OUTPUT/COMM
  5801. End input/output to/from text file or comms
  5802.  
  5803. SET filename
  5804. Read exec or variable file and execute
  5805.  
  5806. GET var/field
  5807. Get character from keyboard no wait
  5808.  
  5809. WAIT FOR time/FOR nexp/var/field
  5810. Wait till time, for no of secs or for single key entry
  5811.  
  5812. ASK [string] [pos] [length] ;var/field
  5813. Get input string from user
  5814.  
  5815. BELL
  5816. Ring bell
  5817.  
  5818. HOME
  5819. Move screen output position to home
  5820.  
  5821. CLS
  5822. Clear output screen
  5823.  
  5824. EJECT [nexp]
  5825. Do new pages on print device
  5826.  
  5827. SCRDUMP
  5828. Do screen dump to printer
  5829.  
  5830. LOCATE coordinates
  5831. Set position on output device
  5832.  
  5833. NEWLINE [nexp]
  5834. Send newline to output device
  5835.  
  5836. MENU column, item, state [, text]
  5837. Set up a user defined menu
  5838.  
  5839. MENU CLEAR
  5840. Clear user-defined menu
  5841.  
  5842. MENU ON numvar
  5843. Turn on user-defined menus, specify variable for return value
  5844.  
  5845. REQUEST text[, ] text[, ] type [, numvar [, textvar [, len]]]
  5846. Set up a user-defined dialog(requester)
  5847.  
  5848. MEMORY
  5849. List of variables in memory
  5850.  
  5851. STATUS [FILE sbfname]
  5852. Status of selected file or system
  5853.  
  5854. SAY [[USING pitch, mode, rate, sex, phonemes] string [, /;string...]]
  5855. Amiga only. Output string as speech
  5856.  
  5857. FG nexp
  5858. Set foreground colour
  5859.  
  5860. BG nexp
  5861. Set background colour
  5862.  
  5863. UL [ON/OFF]
  5864. Set or clear underline
  5865.  
  5866. IT [ON/OFF]
  5867. Set or clear italics
  5868.  
  5869. BF [ON/OFF]
  5870. Set or clear bold face
  5871.  
  5872. ATTR OFF
  5873. Clear bold face italics and underline
  5874.  
  5875. ? /DISPLAY/PRINT/OUTPUT TO file
  5876. Send information to selected output device
  5877.  
  5878. ? SAY
  5879. Use narrator device to speak output
  5880.  
  5881. ? MEMORY
  5882. List of variables in memory
  5883.  
  5884. ? LIST
  5885. Program listing in memory
  5886.  
  5887. ? STATUS [FILE sbfname]
  5888. Status of selected file or system
  5889.  
  5890. ? DIRECTORY
  5891. Current directory listing
  5892.  
  5893. ? TEXT [MERGE]
  5894. Text file in memory optionally mail merging
  5895.  
  5896. ? QUERY
  5897. Current query statement
  5898.  
  5899. ? exprlist
  5900. Any expression list
  5901.  
  5902. REPORTING
  5903.  
  5904. HEADING statements END HEADING
  5905. Specify statements to execute on page heading
  5906.  
  5907. FOOTING statements END FOOTING
  5908. Specify statements to execute on page footing
  5909.  
  5910. REPORT total list
  5911. Set report totals, means and count
  5912.  
  5913. BEFORE REPORT
  5914. Specify before report activity
  5915.  
  5916. AFTER REPORT
  5917. Specify after report activity
  5918.  
  5919. END REPORT
  5920. End of report specifications
  5921.  
  5922. GROUP field total list
  5923. Specify subtotal break field and subtotals, means and counts for group
  5924.  
  5925. BEFORE GROUP statements
  5926. Specify before group activity
  5927.  
  5928. AFTER GROUP statements
  5929. Specify after group activity
  5930.  
  5931. END GROUP
  5932. End of group specifications
  5933.  
  5934. FORM HANDLING
  5935.  
  5936. CLOSE FORM
  5937. Close current form
  5938.  
  5939. OPEN FORM formname
  5940. Load a form into memory
  5941.  
  5942. FORM [, page [, row [, column]]]]
  5943. Specify page for current and top left-hand corner
  5944.  
  5945. ENTER [FORM view name] [field list
  5946. Enter data into fields through view form
  5947.  
  5948. OPERATORS
  5949.  
  5950. ARITHMETIC OPERATORS
  5951.  
  5952. ^
  5953. Exponentiation
  5954.  
  5955. -
  5956. Negation
  5957.  
  5958. *
  5959. Multiplication
  5960.  
  5961. /
  5962. Division
  5963.  
  5964. MOD
  5965. Modulo arithmetic
  5966.  
  5967. +
  5968. Addition
  5969.  
  5970. -
  5971. Subtraction
  5972.  
  5973. RELATIONAL OPERATORS
  5974.  
  5975. =
  5976. Equality
  5977.  
  5978. LIKE
  5979. Pattern matching case insensitive equality
  5980.  
  5981. <>
  5982. Inequality
  5983.  
  5984. <
  5985. Less than
  5986.  
  5987. >
  5988. Greater than
  5989.  
  5990. <=
  5991. Less than or equal to
  5992.  
  5993. >=
  5994. Greater than or equal to
  5995.  
  5996. LOGICAL OPERATORS
  5997.  
  5998. NOT
  5999.  
  6000. AND
  6001.  
  6002. OR
  6003.  
  6004. MATHEMATICAL FUNCTIONS
  6005.  
  6006. SGN(x)
  6007. Sign of variable
  6008.  
  6009. INT(x)
  6010. Integer portion of variable
  6011.  
  6012. ABS(x)
  6013. Absolute value of variable
  6014.  
  6015. SQR(x)
  6016. Square root
  6017.  
  6018. RND(x)
  6019. Random number
  6020.  
  6021. LOG(x)
  6022. Logarithm
  6023.  
  6024. EXP(x)
  6025. Exponent
  6026.  
  6027. COS(x)
  6028. Cosine
  6029.  
  6030. SIN(x)
  6031. Sine
  6032.  
  6033. TAN(x)
  6034. Tangent
  6035.  
  6036. ATN(x)
  6037. Arctangent
  6038.  
  6039. FIX(x, y)
  6040. Fix decimal precision of value
  6041.  
  6042. FREE(n)
  6043. Return free memory size
  6044.  
  6045. DISKSPACE("disk")
  6046. Return free disk space
  6047.  
  6048. RECCOUNT(sbfname)
  6049. Return number of records in file
  6050.  
  6051. SER(sbfname)
  6052. Return serial number of specified file
  6053.  
  6054. ROW(0)
  6055. Return current screen row
  6056.  
  6057. COL(0)
  6058. Return current screen column
  6059.  
  6060. PROW(n)
  6061. Return current printer row
  6062.  
  6063. PCOL(n)
  6064. Return current printer column
  6065.  
  6066. EOF(sbfname)
  6067. Return if at end of file
  6068.  
  6069. FOUND(sbfname)
  6070. Return result of last search
  6071.  
  6072. LOOKUP(value, fld)
  6073. Return if value exists in file(indexed field)
  6074.  
  6075. STRING FUNCTIONS
  6076.  
  6077. LEN(x$)
  6078. Length of string
  6079.  
  6080. STR$(x[[, y] [, z] / [, numformat]])
  6081. String from number with optional format
  6082.  
  6083. VAL(x$)
  6084. Value of string
  6085.  
  6086. ASC(x$)
  6087. Ascii value of character
  6088.  
  6089. CHR$(x$)
  6090. String value of character
  6091.  
  6092. LEFT$(x$, nexp)
  6093. Left portion of string
  6094.  
  6095. RIGHT$(x$, nexp)
  6096. Right portion of string
  6097.  
  6098. MID$(x$, nexp [, nexp])
  6099. Mid portion of string
  6100.  
  6101. DAYS(x$)
  6102. Numeric value of date
  6103.  
  6104. DATE$(nexp [, dform])
  6105. Date string from numeric using optional format
  6106.  
  6107. DAY(date)
  6108. Numeric day value of date
  6109.  
  6110. DAY$(date)
  6111. Day of week from date
  6112.  
  6113. MONTH(date)
  6114. Numeric month value of date
  6115.  
  6116. MONTH$(date)
  6117. Month string from date
  6118.  
  6119. YEAR(date)
  6120. Numeric year value of date
  6121.  
  6122. TIMEVAL(time)
  6123. Numeric value of time
  6124.  
  6125. TIME$(nexp [, tformat])
  6126. Time string from numeric using optional time format
  6127.  
  6128. HRS(time)
  6129. Number of hours from time
  6130.  
  6131. MINS(time)
  6132. Number of minutes from time
  6133.  
  6134. SECS(time)
  6135. Number of seconds from time
  6136.  
  6137. THOUSECS(time)
  6138. Number of thousandths of second from time
  6139.  
  6140. LCASE$(x$)
  6141. Convert string to lower case
  6142.  
  6143. UCASE$(x$)
  6144. Convert string to upper case
  6145.  
  6146. FCASE$(x$)
  6147. Capitalize first letter of string
  6148.  
  6149. TRIM$(x$)
  6150. Trim trailing spaces from x$
  6151.  
  6152. LTRIM$(x$)
  6153. Trim leading spaces from x$
  6154.  
  6155. INSTR([n, ]x$, y$)
  6156. Find position of substring y$ in x$
  6157.  
  6158. REPLICATE(x$, nexp)
  6159. Replicate character expression n times
  6160.  
  6161. SPACES$(n)
  6162. Return string with n spaces
  6163.  
  6164. ERR$(n)
  6165. Returns error message for error number n
  6166.  
  6167. VARIABLES
  6168.  
  6169. TODAY
  6170. Return system date
  6171.  
  6172. NOW
  6173. Return system time
  6174.  
  6175. ERRNO
  6176. Return current error number
  6177.  
  6178. PI
  6179. Return value of pi
  6180.  
  6181. FIELDS BY NAME
  6182. Fieldname; Field.file; Field. "file"
  6183.  
  6184. MULTIPLE RESPONSE FIELDS
  6185. Fieldname(nexp)
  6186.  
  6187. STRING VARIABLES
  6188. X$
  6189.  
  6190. NUMERIC VARIABLES
  6191. X%
  6192.  
  6193. ARRAYS
  6194. X% or X$(nexp[[, nexp] [, nexp]])
  6195.  
  6196.  
  6197.                      SUPERBASE PROFESSIONAL
  6198.  
  6199. Using Superbase Personal Files
  6200. ------------------------------
  6201.  
  6202. Superbase Personal is upwardly compatible with Superbase 
  6203. Professional; so if you have upgraded from one to the other,  you 
  6204. can use any of the files that you created in Superbase Personal. 
  6205. (It doesn't work the other way round: Professional files cannot 
  6206. be loaded into Superbase Personal.)
  6207.  
  6208. However,  there a number of differences in the way the two 
  6209. programs store file data. You should take these into account when 
  6210. you are loading Personal files into Professional. When you save 
  6211. the files,  Superbase Professional will automatically convert them 
  6212. to its own format. But in some cases you may need to edit your 
  6213. Personal files before you can use them. 
  6214.  
  6215. Here is a checklist of the points to bear in mind when converting 
  6216. files from Personal to Professional:
  6217.  
  6218. *  Professional query files include the details of any database 
  6219.    files associated with a query and these files are opened 
  6220.    automatically when the query is loaded. If you use a Personal 
  6221.    query in Professional,  you will need to open the database 
  6222.    files yourself before loading the query. Then save the query 
  6223.    in order to convert it to the Superbase Professional query 
  6224.    format.
  6225.  
  6226. *  Although Superbase Personal does not offer a Constant field 
  6227.    type,  it allows you to create a special type of calculation 
  6228.    formula which acts like a constant formula. For example,  if 
  6229.    you define a single word formula such as "London" or TODAY it 
  6230.    will have the same effect as the equivalent constant formula 
  6231.    in Superbase Professional. When you load a Personal file into 
  6232.    Professional,  calculated fields will be defined as CLC RDO 
  6233.    fields. If they were originally intended to act as constants,  
  6234.    you should change the CLC attribute to CON by selecting Edit 
  6235.    File and editing the file definition. You may also want to 
  6236.    remove the Read Only attribute.
  6237.  
  6238. *  The list of words that are reserved for the use of the system 
  6239.    is more extensive in Superbase Professional than in Superbase 
  6240.    Personal (see the section on Reserved Words further on in this 
  6241.    document). As a result,  you may find that some of the field 
  6242.    names in your Personal files are treated as reserved words in 
  6243.    Superbase Professional. For example,  Professional offers a 
  6244.    large of number of new functions such as YEAR and HRS. If you 
  6245.    have used YEAR as a field name,  it would now become invalid. 
  6246.    Before loading a Personal file,  check that the field names are 
  6247.    valid; if they are not,  change them by editing the file 
  6248.    definition. 
  6249.  
  6250.  
  6251. Edit Form
  6252.  
  6253. The Project menu option,  Edit Form,  runs the Forms Editor as an additional task if it is not already in memory,  provided there is sufficient RAM capacity. If you have opened a form in Superbase, you can use this option to edit it in the Forms Editor and then return to Superbase. 
  6254.  
  6255. For Edit Form to work,  Superbase must be able to locate the Forms Editor program. First it looks for the program in the current directory and then in the root directory of the current device. If this fails,  Superbase will look in the parameters directory as specified in the Options dialog. If the Forms Editor still cannot be found,  Superbase will assume that it resides on a disk with the volume name SBFORMED:. If this disk is not present in the system,  and you have not used the CLI ASSIGN command to specify the location of SBFORMED:,  then an AmigaDOS requester will prompt you to insert it.
  6256.  
  6257. If the Forms Editor is already running when you select Edit Form, then the Forms Editor window is pulled to the front and made active. The current form in Superbase will also be selected for editing. To Return to Superbase you can use the depth arrangement gadget to push the Forms Editor screen to the back.
  6258.  
  6259.  
  6260. Reorganize
  6261.  
  6262. The primary application for Reorganize is as described in the User Guide. It allows you to reclaim disk space after deleting records from a file,  and makes disk operations with the file more efficient. 
  6263.  
  6264. This option can also be used to recover records after their data has been corrupted; i.e.,  when an attempt to open a file produces a disk error message. Reorganize steps over any errors it finds in a file and retrieves as many valid records as it can. The records which have been damaged will be lost when the new file is created so Superbase informs the user with the message: "New file has different record count".
  6265.  
  6266. There may also be circumstances in which Reorganize can be used to recover data which could not be accessed before. For example, if you turned off the computer after storing new records in Batch mode,  the details of these records would not be stored in the file header. Reorganize rewrites the file header so that the records are included in the new file. In this case,  it issues another error message (as well as the one above):
  6267.  
  6268. "Source file size incorrect in header".
  6269.  
  6270. Note that the manual suggests that the best way to recover data from a disk error is to Export the remaining records and then import them to a new file. This method has now been superseded by Reorganize.
  6271.  
  6272.  
  6273. Using the Lookup Function
  6274.  
  6275. There are several points to note in connection with the LOOKUP function:
  6276.  
  6277. *  When you are creating a validation formula (in a file definition) that uses LOOKUP,  you should always enter the function's arguments by typing them into the box at the bottom of the validation dialog. In other words,  even if your LOOKUP formula contains a field which is shown in the field list above,  you should type the field name into the box instead of clicking on it.
  6278.  
  6279. *  It is important to include the file name as an extension to any field name used with LOOKUP. This applies to all fields irrespective of whether their names are unique to one file or not. For example:
  6280.  
  6281.       LOOKUP(Forename.Address, Firstname.Customers)
  6282.  
  6283.    is correct,  while:
  6284.  
  6285.       LOOKUP(Forename, Firstname)
  6286.  
  6287.    may cause problems.
  6288.  
  6289. *  LOOKUP will not work correctly with date/time and numeric fields that have null values -- i.e.,  fields that have been left blank. If you wish to use LOOKUP on fields of this type you must force the first argument to give a null value when empty. For example LTRIM$(DATE$(date field)) will give a null string when the `date field' is empty.
  6290.  
  6291.  
  6292. Amiga Requester Default Keys
  6293.  
  6294. Many of the dialogs in the Amiga version of Superbase accept Return and Escape as keyboard equivalents to clicking on the OK or Cancel buttons. Press the Return key to select OK,  press the Escape key for Cancel. In cases where a casual OK might be destructive,  Superbase does not allow the Return key equivalent.
  6295.  
  6296.  
  6297. Keyboard Equivalents
  6298.  
  6299. In addition to the keyboard equivalents described in the User Guide,  Superbase also provides the following:
  6300.  
  6301. Alt/Amiga B          Toggles Bold (text style) on and off in the Text Editor
  6302. Alt/Amiga U          Toggles Underline on and off
  6303. Alt/Amiga I          Toggles Italic on and off
  6304. Alt/Amiga P          Toggles Plain on,  bold,  italic,  and underline off
  6305. Alt/Amiga B          Toggles Batch mode on and off (this option is only available when the database window is active,  otherwise Alt/Amiga B acts as a keyboard equivalent for the Bold text style)
  6306. Alt/Amiga A          Select the program command line window --equivalent to selecting Command from the Program menu.
  6307.  
  6308. Note that `Amiga' indicates the right Amiga key.
  6309.  
  6310. The keyboard equivalent for Set Paging,  Alt/Amiga P, is no longer available.
  6311.  
  6312.  
  6313. New Editing Controls
  6314.  
  6315. Two new controls have now been provided to allow the user to copy lines in the Program Editor and Text Editor. CTRL L is used to select the line you wish to copy; move the cursor to any point on the line and press CTRL L. CTRL R inserts a copy of the line that has previously been selected with CTRL L; move the cursor to the point in the program or document where the line is to be inserted and press CTRL L. A copy of the line will then be inserted below the cursor.
  6316.  
  6317.  
  6318. Current Record Button
  6319.  
  6320. By now you will have noticed that the current record button on the Control panel does not agree with the illustration in the User Guide on page 1-8. Whereas the guide shows a single triangle (as in Superbase Personal),  the program now has two triangles pointing in opposite directions from each other. 
  6321.  
  6322. The reason for this is that,  in Superbase Professional,  the button has two functions. As well as acting as the current record button,  it also allows you to change current page in a multi-page form. In the first capacity,  it is used to redisplay the current record after the record data has been overwritten or removed from the screen by some other action -- for example,  by Status File. As a page selector,  the same button is used to select either the next page or the previous page. Clicking on the right-hand triangle displays the next page,  clicking on the left-hand triangle displays the previous page.
  6323.  
  6324.  
  6325. Passwords
  6326.  
  6327. In earlier versions of Superbase,  passwords were shown on screen in the Password dialog as you typed them in. Now,  when you type in a password in order to gain access to a file,  the password is not displayed in the Password dialog. 
  6328.  
  6329.  
  6330. RAM disk support (Amiga)
  6331.  
  6332. Normally if you wish to use the Amiga RAM disk within a program, you need to copy data files into the RAM disk before running the program. With Superbase Professional,  this step is unnecessary. You can load data into the RAM disk simply by using the drive identifier RAM: when you open a Superbase file. If the file is not already in the RAM disk,  Superbase will copy it to the disk from the current directory,  and open it at the same time. 
  6333.  
  6334. Superbase also provides a similar service when you close the file. It asks if you want the file to be copied back to the current directory,  i.e. to the floppy or hard disk it was originally copied from. If you click on OK it does the job for you. Should you click on CANCEL the file will not be copied back and you will be asked if you want to erase the copy you have in the RAM disk. Selecting CANCEL will leave the RAM copy intact. 
  6335.  
  6336. (Note that if you open an existing file on RAM disk which has not been put there by Superbase then when you close that file Superbase will not ask you if you wish to copy it back.)
  6337.  
  6338. As an example,  suppose the Address file is stored on the disk in drive DF1: and the current directory is DF1:. To open this file from the RAM disk you would select the Open File option on the Project menu and then enter:
  6339.  
  6340.    RAM:Address
  6341.  
  6342. You can now work on the file in the normal way -- retrieve data, edit data,  remove records,  and so on -- with the advantage that file operations using a RAM disk are much faster than they are on a physical disk. Remember to close the file at the end of a session so that any changes you have made can be saved permanently in the directory from which it was copied. 
  6343.  
  6344. This feature also works with other Ram disk facilities where the drive identifier is VD0: or VDK:.
  6345.  
  6346.  
  6347. Reserved Words
  6348. --------------
  6349.  
  6350. It should be emphasised that the reserved word list includes all Superbase functions even though they are not listed in Appendix C. You should bear this in mind when you are defining a file or writing a program: many of the DML functions have names which you might tempted to use as field or variable names,  for example HRS, DAY,  MONTH,  YEAR.
  6351.  
  6352. Note also the following keywords which should be added to the list in Appendix C.
  6353.  
  6354.  
  6355.    AS
  6356.    BUFFERS
  6357.    CALL
  6358.    COPY
  6359.    DISK
  6360.    DISKSPACE
  6361.    FIELDS
  6362.    PAGING
  6363.    RECORD
  6364.    TABLE
  6365.  
  6366.  
  6367. Graphics and Form Printing
  6368. --------------------------
  6369.  
  6370. On the Amiga,  Printer on the Set menu has been extended to provide a graphics printing option for forms. Selecting this option displays a sub-menu with two items,  Draft and Graphics. Draft works in the same way as is described in the User Guide, Volume 1. When Draft is set,  output that appears on screen is sent to the printer as well; so if you select the next record in the current file,  its field data will be output to the printer. If a form is in use all the text items will be printed as well as the field data. If you wish to print the field data only then you should set the Print Status of the text items to non-printing within the Forms Editor.
  6371.  
  6372. The Graphics option can be used when you are displaying data with a form. It prints all the graphic elements in the form -- lines, boxes,  areas,  images,  and so on -- together with all the data the form displays. Data items are printed in the system font,  text items are printed in the fonts and point sizes which were set in the Forms Editor. However,  Superbase will also take into account the Print Status of an item as set in the Forms Editor.
  6373.  
  6374. On a 512K Amiga,  you will only be able to print four colour forms in either draft or graphics modes.
  6375.  
  6376.  
  6377. Using Superbase as a Relational System
  6378. --------------------------------------
  6379.  
  6380. Although it is impossible to describe the principles of 
  6381. relational database design in this document,  most users will 
  6382. benefit from an abbreviated account of some of the more important 
  6383. facts.
  6384.  
  6385. When you are contemplating the basic design of a relational 
  6386. database application,  there are three key considerations:
  6387.  
  6388. 1.  Establishing relationships between files. Every pair of files 
  6389.     between which there is to be a relationship must have a field 
  6390.     in each file that will be used as the link between them. 
  6391.     These fields should be designated as key fields,  preferably 
  6392.     with unique indexes.
  6393.  
  6394. 2.  Ensuring integrity of relational link data. At the data entry 
  6395.     stage,  what goes into the link fields described above must be 
  6396.     carefully controlled. The aim is to ensure that,  for example,  
  6397.     an account code (usually a text field) is always entered in 
  6398.     the same case in all files in which it is used. This is done 
  6399.     by setting the text field attribute for each of the link 
  6400.     fields to perform automatic case conversion to either upper 
  6401.     or lower case; obviously the conversion must be the same for 
  6402.     both fields. Validation formulas may also be necessary to 
  6403.     check the pattern of what is entered,  its length,  or the 
  6404.     range of acceptable values.
  6405.  
  6406.     The second control on data integrity is via the LOOKUP 
  6407.     function. This enables the system to check what is entered 
  6408.     into the link field in one file against what already exists 
  6409.     in the link field in the other file. For example,  you would 
  6410.     always want to check that a product was in stock before 
  6411.     accepting an order for it. The LOOKUP function is attached to 
  6412.     the link field in the file definition as a validation 
  6413.     formula. However,  if you are using links as described in the 
  6414.     next paragraph,  you must ensure that none of your LOOKUP 
  6415.     functions tries to check for a record that you are still in 
  6416.     the process of creating!
  6417.  
  6418. 3.  Including links in a multi-file form. If you want to design 
  6419.     forms which can retrieve data from more than one file,  you 
  6420.     must use the Set Link menu option in the Forms Editor to 
  6421.     create the links between the files. In Set Link,  you specify 
  6422.     the link fields described above as the master (or primary) 
  6423.     and secondary link fields.
  6424.  
  6425. At the other end of the application,  you will want to retrieve 
  6426. data from your relational system in the most convenient way. 
  6427. There are a number of ways of doing this.
  6428.  
  6429. 1.  Browsing. Use a multi-file form with links set up as 
  6430.     described above. The video buttons operate in the usual way,  
  6431.     and you can switch files and indexes to vary the order of 
  6432.     retrieval. The printer may be used to obtain draft or 
  6433.     graphics hard copy.
  6434.  
  6435. 2.  Queries. The Process Query Edit menu option can be used to 
  6436.     set up multi-file queries,  which may be stored on disk. 
  6437.     Output may include any fields from files between which a 
  6438.     relation is specified in the Filter,  and can be sorted as you 
  6439.     wish. Report functions may be added,  as well as limited 
  6440.     formatting,  but output is basically columnar and non-graphic.
  6441.  
  6442. 3.  Reports. Report programs may be generated automatically with the Forms Editor or written directly in the program editor (the Program Edit menu option). The forms editor allows for multi-line headings and footings,  many levels of subtotalling and sorting,  and full page field positioning,  as well as offering many other features. Relations between files are derived from the links between files,  so here again you must use the Set Link menu option before saving the report form. Output is non-graphic.
  6443.  
  6444.  
  6445. Further Rules for Constructing Queries
  6446. --------------------------------------
  6447.  
  6448. In multi-file queries,  the user (especially the programmer) must exercise extra care to ensure that the query is efficient. The following rules should be observed:
  6449.  
  6450. 1.  Files are processed in the order in which they are mentioned in the WHERE statement (Query Filter Line). In some cases you will want to process the smallest file first,  in some cases you won't. You may have to experiment to find the optimum query for a particular application.
  6451.  
  6452. 2.  Every file reference in the WHERE statement must be part of a chain. WHERE A=B AND B=C is acceptable,  but WHERE A=B AND C=D is not. A simple rule of thumb is that there should always be one less join than the number of files in the query.
  6453.  
  6454.  
  6455. Superbase Start Options
  6456. -----------------------
  6457.  
  6458. When you run SBpro from the CLI,  you can use the following 
  6459. optional parameters:
  6460.  
  6461. SBpro [-c] [-r] [-fformname] [-p] [-s] [-z]
  6462.  
  6463. -c Selects custom screen
  6464. -r Disables returns (chr$(13)) when writing to disk files
  6465. -f Loads form at startup time
  6466. -p Removes remote control panel
  6467. -s Removes scroll bars from Superbase window
  6468. -z removes sizing gadget and disable sizing
  6469.  
  6470. NOTE: Remember to set the stack to at least 8000 before running Superbase from the CLI.
  6471.  
  6472. The start options are also available from the Workbench by setting Tool Types in the Info for the SBpro icon as follows:
  6473.  
  6474. SCREEN=WORKBENCH                    Use Workbench        
  6475. SCREEN=CUSTOM                       Use custom screen
  6476. RETURN=ON                           Enable returns        
  6477. RETURN=OFF                          Disable returns
  6478. SYSTEM=NOPANEL|NOSCROLL|NOSIZE      Remove panel scroll bars and size gadget
  6479.  
  6480. You also may use any combination of the three options in the SYSTEM item.
  6481.  
  6482. You can load a form at startup by creating an icon for it with the default tool set to SBpro and then double clicking on it.
  6483.  
  6484.                DATABASE MANAGEMENT LANGUAGE (DML)
  6485.  
  6486. Changes to DML
  6487. --------------
  6488.  
  6489. Programmers should be aware of the following changes,  extensions and undocumented features in Superbase's Database Management Language:
  6490.  
  6491. 1.  The LOOKUP function is case sensitive -- for example, LOOKUP("fred", Firstname.Address) will not find an occurrence of "Fred".
  6492.  
  6493. 2.  The record SELECT commands (SELECT NEXT,  SELECT LAST,  SELECT KEY etc) have been amended so that they now take another optional parameter,  FORM. The effect of this parameter is to activate any multi-file links that have been set in a form. If it is not used,  the SELECT commands only operate on the current file and ignore any links between files.
  6494.  
  6495.     FORM must be placed immediately after SELECT. For example, with SELECT NEXT command,  you would enter: SELECT FORM NEXT.
  6496.  
  6497. 3.  The KEY command now accepts a numeric key as well as a string key.
  6498.  
  6499. 4.  The commands EJECT,  LOCATE,  and FOOTING do not operate when the current output device is the screen and PAGING is OFF. You can,  however,  use LOCATE with paging off to set the column position -- but not the row position.
  6500.  
  6501. 5.  FORM. This command takes another optional parameter,  SHOW,  which is used to display external files. If the form contains external file fields,  FORM SHOW is equivalent to clicking on the camera button. The syntax for FORM is:
  6502.  
  6503.        FORM [SHOW] [page [, row, column]]
  6504.  
  6505.     Note that the `page' parameter is now optional. When it is omitted and the FORM command is used without any following parameters,  Superbase only displays the field data in a form and omits any other objects. 
  6506.  
  6507. 6.  The command SET BUFFERS only sets the size of the disk buffers for the current session. If you want to set the number of buffers to be saved with the parameters file (SB.PAR),  use the new command SAVE SET.
  6508.  
  6509. 7.  SET TABLE/RECORD/FORM can be followed by the ON parameter. This switches to the specified view mode even if there is a form in memory. Normally SET TABLE,  for example,  acts as a toggle between Table view and the form. If Table view is the current view mode,  this command would switch in the form. SET TABLE ON,  however,  would leave the current view mode as it is. The advantage of this option is that it enables the programmer to select a view mode without having to keep track of what the current mode is.
  6510.  
  6511. 8.  During the execution of a program,  BREAK OFF disables the Stop button and CONTROL-C; also,  you cannot use the space bar to pause during program execution. When the program has finished,  BREAK is turned on again.
  6512.  
  6513. 9.  Apart from the Stop and Pause button,  the remote control panel is disabled while a program is running. Stop is only disabled if the BREAK OFF command has been issued,  Pause is available at all times.
  6514.  
  6515. 10. STORE takes another optional parameter,  FORM. If FORM is used all the records in the current form are saved; otherwise STORE only saves the record which belongs to the current file. 
  6516.  
  6517.     The new syntax for this command is:
  6518.  
  6519.        STORE [, 0/1/2] [FORM]/[FILE sbfname]
  6520.  
  6521.     Note that STORE , 2 secures not only the current file but 
  6522.     also any other open files. It is therefore not necessary to 
  6523.     follow it with the FORM or FILE parameters and,  in fact,  
  6524.     adding one of these parameters to STORE , 2 will cause an 
  6525.     error.
  6526.  
  6527. 11. BLANK can also take FORM as an optional parameter. With a multi-file form,  BLANK FORM creates blank records for each file represented in the form. When the FORM parameter is not included,  BLANK only creates a blank record for the current file. 
  6528.  
  6529.     The syntax for this command is:
  6530.  
  6531.        BLANK [FORM]/[FILE sbfname]
  6532.  
  6533. 12. If SELECT DUPLICATE does not find a duplicate of the current index field,  it leaves the current record unchanged.
  6534.  
  6535. 13. A string function should not contain more than one intermediate string concatenation. For example,  
  6536.  
  6537.        LEFT$("abcde", LEN("x" + "y")) 
  6538.  
  6539.     contains only one intermediate concatenation and gives the correct result,  but
  6540.  
  6541.        LEFT$("ab" + "cde", LEN("x" + "y"))
  6542.  
  6543.     gives the wrong result because it contains two concatenations -- "ab" + "cde" and LEN("x" + "y").
  6544.  
  6545. 14. Superbase already provides you with equivalents for the system commands (or disk utilities) Delete,  Rename and Copy. If you want to use some of the other disk utilities without switching screens or exiting from Superbase,  you can do so with the CALL command. On the Amiga,  you enter:
  6546.  
  6547.        CALL "NEWCLI" 
  6548.  
  6549.     This opens a CLI window on the Workbench screen,  and you can then type in and execute any of the AmigaDOS commands. Alternatively,  you can execute a DOS command directly without first typing it in the CLI window. Thus to list the directory for drive DF1: you would enter:
  6550.  
  6551.        CALL "DIR DF1:"
  6552.  
  6553.     The directory will then be output in either the CLI window used to run Superbase or the small Superbase window opened on the Workbench screen.
  6554.  
  6555.     You may want to use CALL to run a program which requires input from the keyboard. In this case,  you should follow the program file name with the `<*' parameter,  as in:
  6556.  
  6557.       CALL "fcopy <*"
  6558.  
  6559.     The effect of this parameter is to redirect input from `stdin',  allowing you to type in data from the CLI window. 
  6560.  
  6561. 15. With commands that set a single file filter using WHERE (for example,  IMPORT,  EXPORT and SELECT WHERE) you can include ASK as the parameter to the WHERE statement. The effect of ASK is to display the standard filter dialog when the command is executed,  thus allowing the user to set a filter while a program is running. If a filter is present when ASK is executed,  the filter expressions will be presented as a default for the dialog.
  6562.  
  6563.     Examples are:
  6564.  
  6565.        SELECT WHERE ASK 
  6566.  
  6567.     In this example,  ASK causes the filter dialog to be presented. Entering the following filter line (at run-time):
  6568.  
  6569.        Lastname LIKE "[r-z]*" 
  6570.  
  6571.     would have the same effect as executing the command:
  6572.  
  6573.        SELECT WHERE Lastname LIKE "[r-z]*"
  6574.  
  6575.     However,  a partial filter like this is not allowed:
  6576.  
  6577.        SELECT WHERE datefield > ASK
  6578.  
  6579. 16. ENTER. The parameters for this command can only be used with a form. With other view modes,  ENTER (on its own) places the data entry cursor in the first open field that is not Read Only.
  6580.     
  6581. 17. REQUEST. There is now an additional dialog type with the dialog number 19. This displays a list of the forms in the current directory. Note that the description in the DML User Guide for dialog type 5 is incorrect. This dialog provides a list of the fields in the current file. 
  6582.  
  6583. 18. SHOW. The command now takes an optional extension to allow or remove the menu bar from the EFMS screen: 
  6584.  
  6585.       SHOW [MENU ON/OFF] [field]/[strexpr]
  6586.  
  6587. 19. ? QUERY. The syntax for this command has been extended to make it easier to select a device for output. It is no longer necessary to select an output device before executing ? QUERY. Instead you should specify the device using the TO parameter. The new syntax is:
  6588.  
  6589.       ? QUERY [TO device]
  6590.       
  6591.     where `device' can be the printer,  an ASCII file or a new `.sbf' file. If this parameter is not included output is to the screen. The device options are:
  6592.  
  6593.       TO PRINTER
  6594.  
  6595.     Outputs to the printer.
  6596.  
  6597.       TO FILE filename
  6598.  
  6599.     Creates an `.sbf' file on disk under the file name specified.
  6600.  
  6601.       TO filename
  6602.  
  6603.     Outputs to the ASCII file specified by `filename'.
  6604.  
  6605. 19. IF THEN ELSE. The explanation of block IF THEN statements given in the manual needs to be supplemented by two further points:
  6606.  
  6607.     *  Every block IF THEN statement must end with an END IF statement. (Example 4 on page 5-69,  Volume 2,  requires a second END IF after the last line.)
  6608.  
  6609.     *  Within a block IF THEN statement,  you can insert one or more ELSE IF statements. These are used to extend the number of alternatives provided by the original block IF THEN (so that it has the same effect as the CASE statement found in some versions of Basic); but they do not require additional END IF statements.
  6610.  
  6611.     The following examples should make these points clear:
  6612.  
  6613.       IF a% THEN
  6614.       ? atrue$
  6615.       IF b% THEN
  6616.       ? btrue$
  6617.       ELSE
  6618.       ? bfalse$
  6619.       END IF
  6620.       ELSE
  6621.       ? afalse$
  6622.       END IF    
  6623.  
  6624.       IF a% =1 THEN 
  6625.       ? "one"
  6626.       ELSE IF a% = 2 THEN
  6627.       ? "two"
  6628.       ELSE IF a% = 3 THEN
  6629.       ? "three"
  6630.       ELSE 
  6631.       ? "Not 1 to 3"
  6632.       END IF
  6633.  
  6634.  
  6635. New DML Commands
  6636.  
  6637. 1.  SET PG
  6638.     Use this command to set the page size on your printer. It takes the syntax:
  6639.  
  6640.        [SET] PG rows [, columns [, ss]]
  6641.  
  6642.     where rows specifies the number of rows on the page and column specifies the number of columns (the page width). ss stands for single sheet and takes a value of 0 or 1. 0 specifies that single sheet paper is used,  0 specifies continuous stationery,  also known as fan-fold paper. SET is optional.
  6643.  
  6644.     An example of the use of SET PG would be:
  6645.  
  6646.        SET PG 50,  65,  1
  6647.  
  6648.     This line sets the format for a printed page to 50 lines of no more than 65 characters. It also tells Superbase that the printer takes continuous stationery.
  6649.  
  6650.     You can use this command in a program or from the command line to customize a page for any kind of printed output -- whether you are printing a text file,  record data or a report. However setting up the printer in Preferences on the Amiga will override the PG settings.
  6651.  
  6652. 2.  SET PRINTER ON [, 0/1] / OFF
  6653.     This is the program equivalent of selecting Print on the Set menu. The 0 parameter specifies draft mode printing,  and the 1 parameter specifies graphics mode printing. Use this command in conjunction with FORM to obtain form printouts. After SET PRINTER ON has been executed,  any output to the screen will also be sent to the printer,  so remember to SET PRINTER OFF when the print operation is complete.
  6654.  
  6655. 3.  SAVE SET
  6656.     This command saves the Superbase parameter file. It is equivalent to clicking on OK in the Options dialog. All the parameters that have set in the dialog (and those that are set elsewhere) will be saved on disk in the file SB.par.
  6657.  
  6658. 4.  SET MIN
  6659.     This command sets the minimum size allowed for the Superbase window. It takes two optional parameters,  the minimum width and height of the window in pixels,  so the full syntax is:
  6660.  
  6661.       SET MIN [width [, height]]
  6662.  
  6663.     Maximum width is 640,  maximum depth is 183. SET MIN without parameters allows the programmer to lock the window to its current size while a program is running. You cannot use SET MIN to set the window larger than its size when the command is executed. SET MIN can also be executed from the command line or a function key.
  6664.  
  6665.  
  6666. User-Defined Menus
  6667.  
  6668. Other points to note in connection with the commands MENU and MENU ON are:
  6669.  
  6670. *   The first item defines the width of a menu in terms of the number of characters. When you define the text string parameter for item 1 you may need to allow for the width of other items in the menu by adding spaces to the end of the string.
  6671.  
  6672. *   If you wish to use checkmarks in your menus,  remember to leave a space for the checkmark character when you define the MENU text string -- the first character in the string should be a space.
  6673.  
  6674. *   MENU on its own clears all the menu settings (as do ERASE and CLEAR).
  6675.  
  6676. *   After the MENU ON command has been executed,  any menus that have been defined remain active until an item has been selected. The program example on page 5-91 of the DML User Guide is slightly misleading on this point since it suggests that the MENU ON command needs to be executed repeatedly. A better way of checking whether an item has been selected would be:
  6677.  
  6678.       MENU ON a%, b%
  6679.       menuloop: 
  6680.       ON a% GOSUB sub1,  sub2,  sub3
  6681.       GOTO menuloop
  6682.  
  6683.     Note,  however,  that the MENU ON command should be executed again after an item has been selected in order to reset the menu variables to 0. 
  6684.  
  6685.                      FORMS AND FORM HANDLING
  6686.  
  6687. Changing Text Fonts
  6688.  
  6689. Contrary to what is stated in the Forms Editor User Guide,  text fonts can be altered without deleting the text and typing it in again. In fact,  the text font can be treated in the same way as the text style,  as one of the text object's attributes.
  6690.  
  6691. To change the font,  first select the object by double clicking on it; then select the new font from the Fonts menu.
  6692.  
  6693.  
  6694. Using External Files in a Form
  6695.  
  6696. You can use external file fields in a form in the same way as you do in a database file. The difference is that the external files are displayed in the field boxes rather than in a separate window. This means that multiple external files can be displayed at the same time. 
  6697.  
  6698. When you load the form into Superbase,  the box for an external field will show the data in the current record; i.e.,  the name of an external file. To display the file in the box,  click on the camera button. If a box which contains an image file extends beyond the screen,  Superbase will move the form so that it shows as much of the image or text as possible.
  6699.  
  6700. The result of entering a box -- by clicking on it,  or by pressing Return after editing the previous field in the field order -- differs according to whether it contains a text file or an image file. If you enter a text box,  Superbase replaces the box with the Text Editor window (which is given the same dimensions as the box). You can then edit the text in the normal way. Closing the Text Editor window or clicking in another part of the screen, restores the text to the field box,  and moves on to the next field.
  6701.  
  6702. With images,  the effect of entering an external field box is to activate the image colour map: the image is displayed in its original colours. Otherwise,  the image is displayed in the default colours of the form.
  6703.  
  6704. These facilities for showing text and images in external field boxes only operate if the box is more than one character deep. For this reason,  the first thing you should do after placing an external field on a form (in the Forms Editor) is resize it. 
  6705.  
  6706.  
  6707. Amiga Colour Palette
  6708.  
  6709. On the Amiga,  the Colour Palette option (in the Attributes window) has been altered to reflect this computer's special colour features. The Palette now works in the same way as the Preferences colour changing option. It also offers several extra facilities not available in Preferences or in Gem versions of the Forms Editor.
  6710.  
  6711. You may find it helpful to read the section on page 3-9 of the Forms Editor Guide as an introduction to the ideas underlying this feature,  but for detailed instructions on how to use the palette you should consult the next section. 
  6712.  
  6713.  
  6714. Changing the Colour Palette (Amiga only)
  6715.  
  6716. When you click on the Colour Palette icon in the Attributes window,  the Forms Editor will present you with the Colour Selection dialog (requester). At the top,  there are three sliders for defining a colour in terms of its RGB (Red,  Green and Blue) values and a box showing the currently selected colour. The set of colours available to you is shown below in the same format as in the Attributes window -- as two rows of eight colours. If you have previously set the resolution to 4 or 8 colours,  only the first 4 or 8 colours will be available and the rest of them will be ghosted. 
  6717.  
  6718. To change one of the colours in the Palette,  first select it by clicking on its box in the colour panel. The Forms Editor will then do two things: it will display the colour in the box at the top left-hand corner of the Colour Selection,  and it will reset the sliders to reflect the RGB values for the colour you have selected. You can now change the colour by moving the sliders in the same way as you would if you were using Preferences. When you have finished,  click on OK to return to the current Forms Editor page.
  6719.  
  6720. By using this technique,  you could define all the colours in the Palette,  setting the RGB values for each of them in turn. The Forms Editor also provides several other options which allow you to change a number of colours at a time. These options are indicated by the buttons below the colour panel.
  6721.  
  6722. The Copy button enables you to copy a colour from one box to another. The procedure is as follows: first,  click on the colour you wish to copy; second,  click on the Copy button; third,  click on the target colour to which the first colour is to be copied.
  6723.  
  6724. With the Range button you specify the two colours at either end of the range and the Forms Editor then adjusts the colours in between. If you specified white and dark blue,  for example,  the colours in between would be changed to shades of blue from light to dark.
  6725.  
  6726. To set a colour range,  click on the colour which is to form the starting point (or the end point) for the range,  click on the Range button,  then click on the colour at the other end of the range. 
  6727.  
  6728. The Read Prefs button at the right of the colour panel changes the first four colour boxes to the colours that have been set in Preferences. The Reset button reverses the effects of any changes you may have made and restores the colours that were set before you selected the Colour Palette.
  6729.  
  6730.  
  6731. Report Functions
  6732.  
  6733. Apart from COUNT the report functions -- SUM,  MIN,  MAX,  MEAN,  VAR and S.D. -- can only be used with numeric fields. These functions operate either on all the records in a group (if used in an AFTER GROUP section) or on all the records in the report (in an AFTER REPORT section).
  6734.  
  6735. SUM
  6736. Gives the field total for all the records in a group or report.
  6737.  
  6738. MIN
  6739. Returns the minimum value of the specified field among the records in a group or the report.
  6740.  
  6741. COUNT
  6742. Returns the number of records in a group or the report. Unlike the other functions,  COUNT should not be followed by a field name -- it operates on the field specified in the REPORT or GROUP box.
  6743.  
  6744. MAX
  6745. Returns the maximum value of the specified field among the records in a group or for the report.
  6746.  
  6747. MEAN
  6748. Returns the average value of the field data in a group or in the whole report.
  6749.  
  6750. VAR (Variance)
  6751. Provides a measure of the spread of the data from its mean.
  6752.  
  6753. S.D. (Standard Deviation)
  6754. Provides a measure of the spread of the data from its mean -- for the field data in a group or over the entire report.
  6755.  
  6756.  
  6757. Amiga Images
  6758. ------------
  6759.  
  6760. When you add an image to the page,  the Amiga version of the Forms Editor gives you a choice over the colours the image takes. A dialog appears with the message:
  6761.  
  6762.      Use image colour map?
  6763.  
  6764. Clicking on OK selects the image colour map and resets the colour palette to those colours. If you click on Cancel,  the image will be displayed using current range of colours as shown in the Attributes window. The form designer should ensure that only images compatible with the resolution and colour of the form are used.
  6765.  
  6766.                         FORM CALCULATIONS
  6767.  
  6768. Calculation  Types
  6769. -----------------
  6770.  
  6771. The calculations you add to a form have a number of features 
  6772. which are not covered in the Forms Editor guide (you should 
  6773. ignore the calculation examples given in the guide). In fact,  
  6774. with forms that are designed to be used in Superbase,  
  6775. calculations can play a far more important role than is suggested 
  6776. in the guide. This section describes these features in detail.
  6777.  
  6778. Calculations take the same names as DML variables. If they are 
  6779. intended to store string data,  the last character must be `$'; if 
  6780. they are used to store numeric data,  the last character must be 
  6781. `%'.  Calculations referred to by another calculation must 
  6782. already have been added to the form.
  6783.  
  6784. When you create a calculation,  you will be presented with a 
  6785. calculation dialog where you enter the formula for the 
  6786. calculation. Initially,  it will show a list of the fields in the 
  6787. current file which have been added to the form. If you want to
  6788. refer to other calculations in the formula,  click on the multi-
  6789. file gadget. The calculation names will then be listed as if they 
  6790. were fields belonging to a file called FORMCALCS. 
  6791.  
  6792. There are four different types of form calculation,  and each has 
  6793. its own syntax.
  6794.  
  6795. 1.  Blank calculations. These are calculations which do not have 
  6796.     a formula attached to them. They provide a means of 
  6797.     interacting with a form from a program and can be treated as 
  6798.     program variables.
  6799.  
  6800.     To define a calculation of this type,  first enter its name 
  6801.     and then,  without entering a formula,  click on OK in the 
  6802.     formula dialog. Once the form has been loaded into Superbase,  
  6803.     the calculation can be used as a link between the form and a 
  6804.     program. This works both ways: you can assign a value to a 
  6805.     calculation-variable either by typing it in the calculation's 
  6806.     box on the form or by executing an assignment statement in a 
  6807.     program. 
  6808.  
  6809.     Suppose,  for example,  you defined a blank calculation with 
  6810.     the name fred%. In the form's field order fred% is number 5. 
  6811.     If you wanted to input data to a program from the form which 
  6812.     contains fred%,  you would include the program line:
  6813.  
  6814.        ENTER 5
  6815.  
  6816.     When this line is executed,  the input cursor will appear on 
  6817.     screen in the box belonging to fred% and the value entered by 
  6818.     the user will be assigned to fred%. If you now executed the 
  6819.     Memory command,  fred% and its contents will be listed along 
  6820.     with all the other program variables. And any other DML 
  6821.     commands which operate on variables,  such as CLEAR,  will also 
  6822.     work with a calculation variable.
  6823.  
  6824.     To assign the value 22.5 to fred% from within the program,  
  6825.     you would execute the statement:
  6826.  
  6827.        fred% = 22.5
  6828.  
  6829.     This value will then be shown in the calculation box when the 
  6830.     form display is next updated. 
  6831.  
  6832.     Note that ENTER is the only input command that can be used 
  6833.     with a form. Forms are object oriented rather than character 
  6834.     oriented so you cannot use ASK or GET in combination with 
  6835.     LOCATE. Another point to note is that you can only identify a 
  6836.     calculation by its field order number; a command such as:
  6837.  
  6838.      ENTER fred% 
  6839.  
  6840.     will not work.
  6841.  
  6842. 2.  Standard calculations. These function in the same way as the 
  6843.     calculations which are attached to fields,  and they take 
  6844.     exactly the same syntax. In fact,  they can be regarded as a 
  6845.     special kind of field which only exists on a form.
  6846.  
  6847.     The calculation name should not occur in the calculation 
  6848.     formula unless it is a self-referencing calculation. Instead 
  6849.     the result is automatically assigned to the calculation when 
  6850.     the formula is performed; that is,  after each of these 
  6851.     events:
  6852.  
  6853.     * Saving a record
  6854.     * Moving the cursor through the calculation box
  6855.     * Clicking in the calculation box
  6856.     * Retrieving another record,  e.g. by clicking on the Next 
  6857.       Record button or with the command SELECT NEXT 
  6858.     * When you press Return after entering data in the box (only 
  6859.       possible if the calculation is not Read Only)
  6860.  
  6861.     Typically,  this type of calculation is used to derive a total 
  6862.     from the contents of other calculations or fields and then to 
  6863.     display it on the form. Another application would be to 
  6864.     display a date by using the keyword TODAY in the formula. 
  6865.     Examples are:
  6866.  
  6867.       Calculation name         Calculation formula
  6868.  
  6869.       subtot1%                 Quantity * Price
  6870.       name$                    Left$(Firstname, 1) + ". " + Lastname
  6871.       When$                    TODAY
  6872.  
  6873.     If you want to create a self-referencing calculation (see 
  6874.     Self-referencing Formulas,  Chapter 2,  Volume 1),  you need to 
  6875.     add the calculation to the page and then edit it.
  6876.  
  6877. 3.  LET calculations. The formula for this type of calculation 
  6878.     must start with an assignment statement with LET as the first 
  6879.     word. It is used to assign a calculated value to a field or 
  6880.     another calculation. The field may belong to the current file 
  6881.     or another open file. 
  6882.  
  6883.     An example would be:
  6884.  
  6885.       LET Amount.invoice = quantity * cost
  6886.  
  6887.     where this formula is attached to the calculation fred%.
  6888.  
  6889.     Quantity times Cost will be evaluated in the same 
  6890.     circumstances as for type 2 calculations and the result will 
  6891.     displayed on screen in the calculation box belonging to 
  6892.     fred%.
  6893.  
  6894.     When a new record is retrieved,  things happen slightly 
  6895.     differently. The right-hand part of the formula is evaluated 
  6896.     and displayed,  but the value is not assigned to the field 
  6897.     named to the left of the equals sign.
  6898.  
  6899.     As with the other types of calculation,  the result determines 
  6900.     whether the calculation should be defined as a string or 
  6901.     numeric variable; i.e. for a string result,  the calculation 
  6902.     name must end with the `$' character; for a numeric result,  
  6903.     the name must end with the `%' character.
  6904.  
  6905.     If you are using a LET calculation to send or `post' data to 
  6906.     a record in another file,  remember to save the record after 
  6907.     completing a task. 
  6908.  
  6909. 4.  Executable calculations. These calculations contain program statements which are executed when the user passes through the calculation box or clicks on it.
  6910.  
  6911.     A calculation of this type must begin with a DML command as opposed to the name of a variable,  field or calculation. But, to distinguish it from other types of calculations,  the command word should not be LET,  AFTER or POST.
  6912.  
  6913.     Apart from this,  executable commands follow the same rules as for command line statements. Almost any single or multi-statement DML program line can be entered as an executable calculation. This provides immense scope for creating powerful forms with their own built-in processing facility.
  6914.  
  6915.     At the simplest level,  you could use an executable calculation to assign strings to function keys for use in data entry. For example:
  6916.  
  6917.       Key 1,  "London": Key 2,  "New York": Key 3,  "Paris": Key 4,  ...
  6918.  
  6919. More complex applications include running a program, executing another calculation,  etc.
  6920.  
  6921. You can even use the calculation itself as a variable into which the user can enter a value. Thus the following command string could be assigned to the calculation f$:
  6922.  
  6923.       IF f$ = "A" THEN .....  ELSE .....
  6924.  
  6925. To force a calculation,  make it Read Only and next in order.
  6926.  
  6927. You can only make a calculation self-referencing by creating then editing it.
  6928.  
  6929.  
  6930. Calculation Prefixes
  6931.  
  6932. In addition to the four calculation types,  there are two prefixes,  AFTER and POST,  which can be placed in front of the formulas for types 2 and 3.
  6933.  
  6934. AFTER 
  6935. The purpose of AFTER is to force a formula to be performed more frequently than it would be normally. It is followed by an optional field name and is separated from the rest of the formula by a colon. For example:
  6936.  
  6937.     AFTER : Quantity * Price
  6938.  
  6939. Here AFTER forces the formula to be performed whenever any event occurs on the form -- if you click on or pass through a field, when you select a new record,  and when the form is saved. In the example above,  if the formula was attached to the calculation aa1%,  the result would be displayed in aa1%'s box every time the user clicked the mouse in the box or in any other box on the form.
  6940.  
  6941. If a field name is supplied,  AFTER only takes effect after an event relating to the field specified. In the example below, we'll assume the formula is attached to the calculation Tot1%:
  6942.  
  6943.      AFTER Item: Subtot1% * 1.15
  6944.  
  6945. Tot1% will be assigned the result of the formula `Subtot1% * 1.15' after each of these events:
  6946.  
  6947. *  the cursor passes through the Item field
  6948. *  the user clicks in the Item box 
  6949. *  the value of Item changes
  6950. *  all the usual events that cause evaluation of the formula
  6951.  
  6952. POST 
  6953. Just as there are some calculation formulas which need to be performed repeatedly -- for these you will use AFTER -- so there are others which should only be performed once,  when a record is saved. With POST,  you can ensure that a result is only stored in a field (posted to another file) after the other calculations in the form have been carried out.
  6954.  
  6955. POST takes the syntax:
  6956.  
  6957.    POST [LET xxx =] expression
  6958.  
  6959. where xxx is a field name and the expression can be another field,  a calculation,  or a formula which calculates a result. The expression is not evaluated until the record is stored,  unless the LET part of the formula is included. If this is the case,  the expression is evaluated subject to the normal rules,  but the assignment of LET is not made until the record is stored.
  6960.  
  6961. Take,  for example,  the formula:
  6962.  
  6963.    POST LET Cust_Balance.Customers = Cust_Balance.Customers +    
  6964.    Order_Amount.Orders
  6965.  
  6966. Order_Amount could represent the final figure in a series of calculations which work out the final value of an order. Clearly, we do not want the total to be stored in the Customers file until all the calculations have been performed. By preceding the formula with POST we can ensure that this condition is satisfied. However,  intermediate results can be shown on the form by clicking in the calculation box to which this formula is attached.
  6967.  
  6968.                           MISCELLANEOUS
  6969.  
  6970. *   In some circumstances the Update option may skip some of the 
  6971.     records in the file it is updating. The problem occurs when 
  6972.     the update modifies a field which also forms part of the 
  6973.     update filter; for example,  it would occur if the update 
  6974.     fields instruction was:
  6975.  
  6976.        Salary = Salary * 1.075
  6977.  
  6978.     and the update filter was:
  6979.  
  6980.        Salary >= L8000 
  6981.  
  6982.     The solution is to enclose the filter statement in 
  6983.     parentheses,  as in:
  6984.  
  6985.        (Salary >= L8000)
  6986.  
  6987.     If you were running this example update under program 
  6988.     control,  you would place the entire WHERE statement within 
  6989.     parentheses:
  6990.  
  6991.       (WHERE Salary >= L8000)
  6992.  
  6993.     This solution works by disabling the automatic optimization 
  6994.     which causes the problem.
  6995.  
  6996. *   If you try to print a line longer than the line length set in 
  6997.     Superbase's Printer options,  Superbase will output a Carriage 
  6998.     Return followed by a Line Feed when it reaches the maximum 
  6999.     line length.
  7000.  
  7001. *   Note that Amiga owners can set a printer initialization 
  7002.     sequence from within Superbase's Set Options dialog. This 
  7003.     allows you to set the features and modes you prefer. The 
  7004.     sequence of control codes is sent to the printer each time 
  7005.     you perform a printing operation from within Superbase. If a 
  7006.     sequence is present Superbase does not send the `Skip over 
  7007.     perforation OFF' and `Set page length' codes that are 
  7008.     normally sent when the printer is accessed.
  7009.  
  7010. *   The output format parameters BF,  UL,  IT enable you to set different print styles within a report or in the output from a query. If you wish to set other printing features,  you can do so by using the CHR$ function to insert the appropriate printer control codes. With a report which has been generated in the Forms Editor,  you will need to insert the control code sequences in the report program. In a query,  you can simply enter them in the query fields line. For example,  on some Epson printers,  the sequence 27,  14 selects enlarged print, and the control code 20 turns it off. To output the data for one field in enlarged print,  your query Fields line might look like this:
  7011.  
  7012.       Firstname,  Lastname,  CHR$(27);CHR$(14);City;CHR$(20),  Street
  7013.  
  7014.     Note that some control codes may be inappropriately 
  7015.     interpreted by the printer device,  in which case you should 
  7016.     set Print Raw on the Options requester to bypass the 
  7017.     interpretation.
  7018.  
  7019. *   Path names. Superbase accepts path names up to 40 characters 
  7020.     long (not including the file name).
  7021.  
  7022. *   File Names. Avoid using the characters : ? # / ; or the space 
  7023.     character. When using a file name as an argument to a command 
  7024.     such as OPEN FILE,  it must always be inside quotation marks. 
  7025.     However,  a file name used to extend a field name,  e.g. 
  7026.     Name.Customers,  need not be inside quotes,  unless it includes 
  7027.     non-alphanumeric characters,  i.e. other than a-Z and 0-9. 
  7028.     Superbase supplies quotes when necessary during dialog 
  7029.     selections,  but if you type a command line in directly be 
  7030.     sure to observe this rule.
  7031.  
  7032. *   The Duplicate option on the Record menu re-initializes any 
  7033.     constant formulas. This means you can duplicate a record 
  7034.     which contains the constant formula SER without duplicating 
  7035.     its serial number. Similarly,  if a file uses the constant 
  7036.     formula TODAY,  creating a new record by duplicating an 
  7037.     existing record does not reproduce the original date.
  7038.  
  7039. *   Superbase and the Forms Editor require a large amount of chip 
  7040.     memory when printing a form in graphics mode. If your Amiga 
  7041.     only has 512K RAM,  the graphics print option may not be 
  7042.     usable.
  7043.  
  7044. *   The DML LABELS examples on page 5-78 are wrong. Example 1 
  7045.     should not suggest that the command can extend over more than 
  7046.     one line; example 2 requires the keyword FILE after LABELS.
  7047.  
  7048. *   The normal New Line sequence on the Amiga is a CHR$(10) (line 
  7049.     feed). On most other machines and in Superbase,  the default 
  7050.     New Line sequence is CHR$(13) CHR$(10) (carriage return,  line 
  7051.     feed). The CHR$(13) may be suppressed,  for example to achieve 
  7052.     compatibility with the ED editor,  by setting RETURN=OFF in 
  7053.     the Tool Types list of the Superbase icon,  which may be 
  7054.     modified using the Workbench Info option.
  7055.  
  7056. *   GET and WAIT (1). Control characters can be returned in GET 
  7057.     and WAIT statements. If these are saved in a file which is 
  7058.     subsequently LISTed,  they will generate the "File contains 
  7059.     non-text characters" error. Note also that CONTROL-C,  the 
  7060.     standard interrupt key,  does not stop program execution if 
  7061.     returned in GET or WAIT. It is up to the program to detect 
  7062.     the value and act appropriately.
  7063.  
  7064. *   GET and WAIT (2). WAIT makes the window active before it 
  7065.     starts waiting for input,  so if the window becomes inactive 
  7066.     for any reason you cannot reactivate it. If this is a problem 
  7067.     for your application,  use GET instead; however,  you will not 
  7068.     be able to input into any other window,  such as a CLI window,  
  7069.     because GET continually reactivates the Superbase window.
  7070.  
  7071. *   The CLEAR statement must be placed last on a program line.
  7072.  
  7073. *   You may want to convert Superbase text files (`.sbt' files) 
  7074.     to ASCII files. The technique for doing this is:
  7075.  
  7076.      1. Rename the `.sbt' file,  giving it a different extension. 
  7077.         E.g.,  rename `Merge.sbt' as `Merge.asc'.  
  7078.      
  7079.      2. Load the file into the Text Editor. Its name will not 
  7080.         appear in the list of files presented by the Project Open 
  7081.         dialog and you will have to type it into the dialog box 
  7082.         (remember to include the extension name).
  7083.  
  7084.      3. Delete the lines containing information about ruler 
  7085.         lengths. These will be blank lines except for two figures 
  7086.         which give the start and end points for the ruler that is 
  7087.         attached to the following paragraph.
  7088.  
  7089.      4. Save the file using the same name with which it was loaded.